scrollTop在Firefox和IE上不起作用?
我有下面的代码,在chrome中工作正常。
但是,它不适用于Firefox和IE。 什么都没发生。
$("body").animate({scrollTop:$(this).offset().top},800);
所以我可以问我应该为firefox和IE写什么?
谢谢。
尝试使用
$('body,html').animate({scrollTop:$(this).offset().top},800);
代替
$("body").animate({scrollTop:$(this).offset().top},800);
试试这个。
document.getElementsByTagName('body')[0].clientHeight
$(body).scrollTop($(this)[0].scrollHeight);
您使用此代码,我认为它将在IE和Firefox中正常工作