Created
July 25, 2013 12:01
-
-
Save ourmaninamsterdam/6079009 to your computer and use it in GitHub Desktop.
jQuery waypoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setup waypoints for each block | |
$('.js-block').each(function(){ | |
addWaypoint( $(this), 'down' ); | |
addWaypoint( $(this), 'up' ); | |
}); | |
function addWaypoint( $elem, direction ){ | |
var thisID = that.formatID( $elem.attr('id') ), | |
nextID = $elem.next('.js-block').attr('id') || null; | |
$elem.waypoint( function( ){ | |
waypointHandler( $elem ); | |
},{ | |
offset : function(){ | |
if( direction === 'up' ){ | |
return getOffset( thisID, nextID, 'up' ); | |
} | |
return -CONFIG.pageWaypoints[ thisID ]; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment