0
我正在使用一些jQuery我碰到平滑滚动锚页链接。我现在意识到这个脚本中有一些东西阻止锚链接(例如,'#top')出现在URL中,我确实希望URL中的锚链接。有人能告诉我这是什么部分关闭了默认行为,我能做些什么来重新打开它?脚本阻止锚链接出现在网址中
<script>
$(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
}, 500);
return false;
}
}
});
});
</script>
你不能比....页面会跳转击败什么插件做。 – epascarello
@epascarello yup ...当然会 – charlietfl