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>
請幫幫我!
*,但劇本不起作用*非常模糊 –
對不起,你說的這個腳本是非常模糊的,但我看到在各種網站上的這個腳本。 –
你能做一個小提琴嗎? –