Reputation: 31
I have an element that slides down when reaching the #news div, and slides up when passing the #news upon sliding up.
$(document).ready(function() {
$('#news').waypoint(function(event, direction) {
if (direction === 'down') {
$('#menu_list').animate({top: 10},{queue: false, duration:500}) ;}
else {
$('#menu_list').animate({top: 50},{queue: false, duration:500}) ;}
}, {
offset: '6'
});
});
I would like to know how to apply the " .waypoint('remove') " ? In order to make it slide up when leaving the div when sliding even futher down the site and going into other div. This way I could make animation like - slide in / stop in position / slide out.
If waypoints isn't the correct plugin to do this I would really appreciate some indications how to achieve such effect.
Thanks !
Upvotes: 3
Views: 7494
Reputation: 782
$('#news').waypoint('destroy') — Unregister waypoints and unbind all handlers.
$('#news').waypoint('remove') — Unregister waypoints but leave handlers intact.
Have you read the Waypoint full documentation ??
Src : http://imakewebthings.com/jquery-waypoints/#documentation
Upvotes: 8