0
我用光滑的脚本滚动我的网页,但脚本不工作我很困惑我哪里错了,请帮我如何我的页面滚动下来平滑滚动
我的脚本是:
$(".scroll").click(function(event){
event.preventDefault();
//calculate destination place
var dest=0;
if($(this.hash).offset().top > $(document).height()-$(window).height()){
dest=$(document).height()-$(window).height();
}else{
dest=$(this.hash).offset().top;
}
//go to destination
$('html,body').animate({scrollTop:dest}, 1000,'swing');
});
和我在锚标记使用.scroll此类型:
<a class="scroll" href="#bot">Click here</a>
请帮帮我!
*,但剧本不起作用*非常模糊 –
对不起,你说的这个脚本是非常模糊的,但我看到在各种网站上的这个脚本。 –
你能做一个小提琴吗? –