question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger vue method if is-inview via data-scroll-call?

See original GitHub issue

Hey 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>

https://codesandbox.io/s/codesandbox-nuxt-7kb0f

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
regenrekcommented, Aug 9, 2019

It looks kind of a workaround but this is way more than I’ve expected. Thanks!

1reaction
jp-prietocommented, Aug 8, 2019
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found