AngularJS scrollstop and scrollstart events.
0 people use it
Author: 7130591?v=2 HHogg
Submitted by: 7130591?v=2 HHogg


Simple AngularJS service and directives for detecting when a user has stopped and started scrolling.


Have a look at both of them in action , demo here.


Bower: $ bower install angular-scroll

Remeber to add hg.scrollstop to your module dependencies :wink:

Service hgScrollEvent

The hgScrollEvent service provides two functions; scrollstart and scrollstop. Each can execute a callback and broadcast an event down the scope of the element the event is attached to.

.scrollstop([element [, callback] ]);

.scrollstart([element [, callback] ]);

Pass an element as the first argument to attach the scroll event to, and a callback function as the second argument.

... or just pass a callback function and the event will be attached to $document

... or just pass an element and it will broadcast the event down the scope and perform no callback.

... or supply no arguments to broadcast the event when the document is scrolled.

Just listen for the event like you would with any other, with the angular event, scroll event, and the attached elment provided in the callback.


Two directives are provided to easily use the scrollstop and start events on elements. The events are binded to the element they are used on and can be provided (or not) a callback function.



comments powered by Disqus
This page was last updated about 4 years ago.