flow-events
v1.0.0
Published
scroll-into-view solution for overflow scrolling
Downloads
1
Readme
flow-events.js
If you have a container that uses overflow scrolling on a page, it's helpful to have elements generate events as they come into visibility(currently requires jQuery via UMD, but can be shimmed with any compatible lib).
Usage
To detect scroll geometry events for all elements inside container
who are of type img.preview
and we want a notification each time one of these scrolls into view.
FlowEvents.enableOn(container, 'img.preview', {
onScrollIn : function(el){
//do stuff here
}
}
alternatively you can just enable the event and detect them bubbling through the DOM.
FlowEvents.enableOn(container, 'img.preview');
Then later
myEl.on('flow-in', function(){
//do stuff here
})
Available Events
There are a few events that can be generated:
flowing
: an unseen element scrolls partially into viewflow-in
: an unseen element scrolls fully into viewflow-out
: a visible element scrolls fully out of viewflow-begin
: generated when scrolled to the left extent of the containerflow-begin-away
: generated when scrolled away from the left extent of the containerflow-end
: generated when scrolled to the right extent of the containerflow-end-away
: generated when scrolled away from the right extent of the container
and a couple more planned (but unimplemented) ones:
buffer-in
: generated when an unseen element scrolls into the buffer zonebuffer-out
: generated when an unseen element scrolls out of the buffer zone
####Future Features
- optional debouncing for heavy load
- buffer zones
- short circuit chrome's weird gesture/back behavior on OSX
Testing
for the local tests, just run
mocha
Enjoy,
-Abbey Hawk Sparrow