BKWLD / vue-in-viewport-directive

Vue 2 directive that adds css classes when the element is the viewport
https://bkwld.github.io/vue-in-viewport-directive
MIT License
120 stars 7 forks source link

Class binding not working with CSS Modules #6

Open shawnolson-fp opened 5 years ago

shawnolson-fp commented 5 years ago

I have a div styled as such using CSS modules syntax ...

<div :class="$style.containerCTA" v-in-viewport></div>

Style looks like this ...

<style lang="stylus" scoped module>
.containerCTA {
    display: flex;
    align-items: center;
    max-width: 114rem;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translate3d(0, 5px, 0);
    transition: opacity 0.2s, transform 0.3s;

    &.in-viewport {
      opacity: 1;
      transform: none;
    }
  }
  </style>

screen shot 2018-12-11 at 6 46 56 am

But it never actually does anything because the class isn't native... any suggestions?

weotch commented 5 years ago

Sorry, not really. We don't use css modules so I haven't run up against this.