Created
July 11, 2013 11:45
-
-
Save ruizfrontend/5974750 to your computer and use it in GitHub Desktop.
waypoints samples
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
$('ELEMENT').waypoint( function(direction) { | |
if (direction == 'down') { | |
console.log($(this).attr('id'), 'disappears top'); | |
} else { | |
console.log($(this).attr('id'), 'appears top'); | |
} | |
}, { offset: function(){ | |
return -$(this).height(); | |
}, triggerOnce: true, continuous: true}) | |
$('ELEMENT').waypoint( function(direction) { | |
if (direction == 'down') { | |
console.log($(this).attr('id'), 'appears bottoms'); | |
} else { | |
console.log($(this).attr('id'), 'disappears bottoms'); | |
} | |
}, { offset: function(){ | |
return $.waypoints('viewportHeight'); | |
}, continuous: true}) | |
$('ELEMENT').waypoint( function(direction) { | |
if (direction == 'down') { | |
console.log($(this).attr('id'), 'next element appears'); | |
} else { | |
console.log($(this).attr('id'), 'next element is no more'); | |
} | |
}, { offset: 'bottom-in-view', continuous: true}) | |
$('ELEMENT').waypoint( function(direction) { | |
if (direction == 'down') { | |
console.log($(this).attr('id'), 'previous element is no more'); | |
} else { | |
console.log($(this).attr('id'), 'previous element appears'); | |
} | |
}, { offset: function(){ | |
return -$(this).height(); | |
}, continuous: true}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment