0
我已經使用平滑滾動插件從CSS技巧, 它的工作很好,但只有2 ancoher鏈接,而不是一個又一個,請在這裏看到演示,平滑滾動跳躍而不是滾動
它的工作非常適合行業和定價,但在證明書中,它只是跳到位置,固定導航也截斷了該部分。
<script>
$(document).ready(function() {
$('a[href^="#"]').on('click', function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top - 130 // - 130px (nav-height)
}, 900, 'swing', function() {
// Replace this with something that can be easily parsed and used by your code
window.location.hash = '3' + target;
});
});
});
</script>
添加了完美的標識和散列到鏈接,但仍然不能正常工作 –
我可以看到一個示例代碼? –