我一直在抨击我的头靠在墙上,试图使用大量顺畅的滚动插件来工作,为什么注册按钮无法顺利地向下滚动到#target部分。平滑滚动无法正常工作
请帮助蜂巢介意,我正在使用CSS技巧代码。
$('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;
}
}
});
您可以在
https://codepen.io/samducker/pen/RVoORy
作品一个好心的兄弟,我以前使用的代码如何处理所有css技巧示例,但是在我的页面上不起作用? –
我不知道。也许是一个复制粘贴问题。因为你可以保留你的解决方案,只需将('a [href * =#]:not((href =#])')改为('a [href * =“#”]:not([href =“# “])') – RacoonOnMoon
我不想贪心,但你可以选择与绿色勾号正确的答案。会有帮助的:) – RacoonOnMoon