Trigger vue method if is-inview via data-scroll-call?
See original GitHub issueHey is it possible to trigger events on data-scroll-section
and do animations with js instead of css? Since I want to use gsap for building the animation timeline
- index.vue / nuxtjs
<template>
<section>
<div id="js-scroll" :data-scroll-call="sectionAnimIsInView">
<div data-scroll data-scroll-speed="1" class="box red"></div>
<div data-scroll data-scroll-speed="2" class="box blue"></div>
</div>
</section>
</template>
<script>
// import TimelineMax from 'gsap/TimelineMax';
export default {
data() {
return {
lmS: null
};
},
mounted() {
this.lmS = new this.locomotiveScroll({
el: document.querySelector("#js-scroll"),
smooth: true
});
console.log("lmS", this.lmS);
},
methods: {
sectionAnimIsInView(elems) {
// const tl = new TimelineMax();
// tl. .... do something
}
}
};
</script>
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Is it possible to trigger a function upon a Vue data element ...
I was wondering if it is possible to trigger (run) a function upon the change of a specific data element. Reactivity in Depth...
Read more >Create a Unique Scrolling Website With Locomotive Scroll ...
The job of the data-scroll-call attribute is to trigger Locomotive's call event. The attribute value that can be anything we want is passed...
Read more >Watchers | Vue.js
Watchers declared using the watch option or the $watch() instance method are automatically stopped when the owner component is unmounted, so in most...
Read more >Event Handling - Vue.js
Inline handlers: Inline JavaScript to be executed when the event is triggered (similar to the native onclick attribute). Method handlers: A property name...
Read more >Methods and Event Handling - vue.js
Instead of binding directly to a method name, we can also use an inline JavaScript ... You can pass it into a method...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks kind of a workaround but this is way more than I’ve expected. Thanks!
Hey @regenrek check this out:
https://codesandbox.io/s/codesandbox-nuxt-mhobt
Hope it helps