![](/img/trans.png)
[英]Smooth scrolling animation to sections of page in IE on Windows Phone
[英]scrollTop() is not scrolling to the correct place on IE windows 8 phone
尽管浏览器返回正确的高度,但它在任何地方都可以正常工作,但它滚动到错误的位置(每次都不同),这仅在IE W8手机上发生,以下是代码:
$("#navigation-wrapper a").click(function(e){
$headerHeight = $("#header").height();
var $anchor = $(this);
$('html, body').stop().animate({scrollTop: $($anchor.attr('href')).offset().top - $headerHeight});
e.preventDefault(); });
任何想法?
虽然这很麻烦,但是由于某种原因它起作用了。 为了滚动到正确的位置,我不得不两次调用动画。
$('html, body').stop()
.animate({scrollTop: $($anchor.attr('href')).offset().top - $headerSize},function(){
$('html, body').stop()
.animate({scrollTop: $($anchor.attr('href')).offset().top - $headerSize});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.