0

What I want: - I want to detect when a user is scrolling the page. Not once, but every single time. - When user stopped scrolling, something must happen.

What I DONT want: detect when the page is scrolled to a certain point(so no waypoints.js).

A solution that I've tried at first:

$(window).scroll(function() {
    console.log("page scrolled");
});

Problem is, he fires the console.log way too many times. So maybe I need some sort of delay, but I don't know how to fix that properly.

Hope someone of you can help!

Luc
  • 1,765
  • 5
  • 24
  • 44
  • Are you talking about something like **[THIS](http://jsfiddle.net/andrewwhitaker/24M3n/1/)**? – Pavlo Mar 04 '14 at 16:12

1 Answers1

2

Try this solution to fire alert when page stop scrolling.

code

var timer;
$(window).on('scroll',function () {
    clearTimeout(timer);
    timer = setTimeout( scrollStop , 150 );
});
var scrollStop = function () { 
    // do stuff
    alert('Scrolling Stop'); 
};

Fiddle Demo

Reference post

Community
  • 1
  • 1
Rakesh Kumar
  • 2,705
  • 1
  • 19
  • 33