Javascript 平滑滚动jquery脚本在chrome中可用,但在firefox中不可用??为什么?
在google chrom中工作正常,但在firefox中不起作用。 我有一些坏代码,还是浏览器有问题Javascript 平滑滚动jquery脚本在chrome中可用,但在firefox中不可用??为什么?,javascript,jquery,Javascript,Jquery,在google chrom中工作正常,但在firefox中不起作用。 我有一些坏代码,还是浏览器有问题 <script type="text/javascript"> $("#menu a").click(function(){ var faqId = $(this).attr("href"); $("body").animate({scrollTop: $(faqId).offset().top}, "slow"); return false; });
<script type="text/javascript">
$("#menu a").click(function(){
var faqId = $(this).attr("href");
$("body").animate({scrollTop: $(faqId).offset().top}, "slow");
return false;
});
$("#footer a").click(function(){
var faqId = $(this).attr("href");
$("body").animate({scrollTop: $(faqId).offset().top}, "slow");
return false;
});
</script>
$(“#菜单a”)。单击(函数(){
var faqId=$(this.attr(“href”);
$(“body”).animate({scrollTop:$(faqId.offset().top},“slow”);
返回false;
});
$(“#页脚a”)。单击(函数(){
var faqId=$(this.attr(“href”);
$(“body”).animate({scrollTop:$(faqId.offset().top},“slow”);
返回false;
});
要支持Firefox,还需要设置HTML标记的动画:
$("body, html").animate(...);