请检查此页面(例如)
http://www.christinamichael.in/create-a-powerful-human-disintegration-effect-in-photoshop
我想知道我怎么会有这样的东西?
我希望 firefox 和 chrome 支持一些东西。
最佳答案
您可以使用 ANCHOR 标签进行平滑滚动。 以下结果。
$(function() {
$('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
}, 1000);
return false;
}
}
});
});
关于javascript - 滚动条和平滑滚动代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21430684/