1

I am developing a website and need to trigger a function when the webpage is not scrolling.

Something like:

$("window").notscroll(function() {
    //stuffhere
});

Answer can be in either javascript or jQuery.

Hopefully this is possible!

alix
  • 43
  • 5
  • 3
    So when I'm sitting here not scrolling, will this just fire over and over every cycle? – Mark Oct 28 '19 at 03:15
  • @MarkMeyer the event was just to change an element of css so it wouldnt matter if it fired constantly – alix Oct 28 '19 at 03:20
  • 1
    @alix *the event was just to change an element of css..* this is your problem, and this should be the post, not the solution you intent to implement. – Nidhin Joseph Oct 28 '19 at 03:22

1 Answers1

1

Not sure what are you trying to achieve but you can use JQuery Debounce to detect when the user stopped scrolling. Combine this when document first loads if you also need to change css on document load.

$(window).scroll($.debounce( 250, true, function(){
    $('#scrollMsg').html('It is SCROLLING.');
}));
$(window).scroll($.debounce( 250, function(){
    $('#scrollMsg').html('DONE SCROLLING!');
}));