2014-07-14 58 views
0

我的頁面目前在頂部有一個標題,並帶有不同的鏈接。點擊鏈接時,頁面會自動滾動到頁面的該部分。我正在使用這個jQuery代碼進行自動滾動:如何在頁面自動滾動時使鏈接反彈?

$("#about").click(function(e){ 

     var targetOffset= $("#two").offset().top; 
     $('html, body').animate({scrollTop: targetOffset}, 1500); 
     e.preventDefault(); 

});

我想在鏈接上使用jQuery UI反彈效果,以便它在頁面滾動時反彈。我如何使這些效果同時發生?另外,如何鏈接到HTML文檔中的jQuery UI文件?

+0

檢查http://stackoverflow.com/questions/10251109/jquery-animate-with-effect-bounce-after-animation-做完了 – ariestikto

回答

1

你可以設置緩和這樣的:這裏

$('html, body').animate({scrollTop: targetOffset}, {duration: 1000, easing: 'easeOutBounce'}); 

see more about easing here

相關問題