2012-07-12 44 views
3

我有一個元素在到達#news div時向下滑動,並在向上滑動時通過#news時滑動。jQuery刪除航點

$(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' 
    }); 
}); 

我想知道如何應用「.waypoint('remove')」?爲了讓它在離開div時向上滑動,甚至向下滑動網站並進入其他div。 這樣我可以使動畫像 - 滑入/停止位置/滑出。

如果航點並不是正確的插件,我真的很感謝一些跡象表明如何實現這種效果。

謝謝!

回答

7
$('#news').waypoint('destroy') — Unregister waypoints and unbind all handlers. 
$('#news').waypoint('remove') — Unregister waypoints but leave handlers intact. 

您是否閱讀過Waypoint完整文檔?

源:http://imakewebthings.com/jquery-waypoints/#documentation

+0

是的,當我把$(「#新聞」)航點(「刪除」)的代碼,它被instatly刪除,未達到#news DIV之後,當它的。刪除,'其他'將不起作用。 – user1519385 2012-07-12 07:06:11