2016-12-14 55 views
0

嗨,大家好,我們有我們的頭版位置:http://wp.partyloo.com/JS滾輪滾動犯規順利

而且我加了一個滾輪向下箭頭,它在它下面下一節向下滾動。

我得到了以下HTML:

<a id="scroll" href="#second"><i class="fa fa-angle-down" style="font-size:54px; color: #fff; text-align: center; display: block; margin: 0 auto;" aria-hidden="true"></i></a> 

這裏就是我放置JS:

$('a[href*="#"]:not([href="#"])').click(function() { 
    if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 
    var target = $(this.hash); 
    target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 
    if (target.length) { 
     $('html, body').animate({ 
     scrollTop: target.offset().top 
     }, 600); 
     return false; 
    } 
    } 
}); 

現在當你點擊箭頭並不順利向下滾動。當你點擊它時,會自動帶你到下一個div /節。

我該如何放一些流暢的動畫,讓它平滑順滑地向下滾動?

在此先感謝!

回答