我在我的網站上滾動時遇到了一些問題。看起來,當你點擊鏈接到正確的頁面,但如果你然後嘗試上下滾動它不正確,它跳轉到頂部。網站滾動問題
例如在我的頁面上,如果你點擊「開始你的冒險」,然後向上滾動,它會跳躍。與圖片鏈接相同。
我已經試過我的網站上添加的jQuery平滑滾動https://raw.githubusercontent.com/kswedberg/jquery-smooth-scroll/master/jquery.smooth-scroll.js 那麼下面的JS:
$(document)
.on('click', 'a[href*="#"]', function() {
if (this.hash && this.pathname === location.pathname) {
$.bbq.pushState('#/' + this.hash.slice(1));
return false;
}
})
.ready(function() {
$(window).bind('hashchange', function(event) {
var tgt = location.hash.replace(/^#\/?/,'');
if (document.getElementById(tgt)) {
$.smoothScroll({scrollTarget: '#' + tgt});
}
});
$(window).trigger('hashchange');
});
如果平滑滾動不起作用,只要用戶可以正常滾動,我不介意沒有這個跳躍這將是很好
同任何的照片鏈接,如「需要知道」和「瞭解更多」 – user3005003