[Vuejs]-Detecting scroll in vue.js

0👍

You can use the scroll event and fire your function when needed

    window.addEventListener('scroll', function(e){
        if(e.pageY>window.innerHeight*0.05){
            console.log('over 5%'); //use your function here
        }
    });

Make sure you remove the event listener when you don’t need it anymore or your component unmounts

Leave a comment