Skip to content

Trigger events based on the position of the scrollbar (and visibility of elements on the page as they are scrolled into/out of view).

Notifications You must be signed in to change notification settings

shorttompkins/scrollToggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scrollToggle

Trigger events based on the position of the scrollbar (and visibility of elements on the page as they are scrolled into/out of view).

To use:

*Include jQuery and scrollToggle.js

//ScrollToggle(verticalScrollTriggerPosition, callbackScrolledTO, callbackScrolledAWAY)

//verticalScrollTriggerPosition can be a number, property, or computed. It is the vertical Y coord of the scrollbar destination.

var myScroller = new ScrollToggle($('#block1').position().top, function () {
    console.log("Element has been reached.");
}, function () {
    console.log("Element is gone.");
});

A working example can be found here: http://kroltech.com/upload/misc/scrollToggle_Sample/

A better production sample can be found here: http://www.nextgenugm.com (the orange dots in the right vertical nav change based on the sections as they scroll into view).

About

Trigger events based on the position of the scrollbar (and visibility of elements on the page as they are scrolled into/out of view).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published