[英]jQuery animate scrolltop() not scrolling downwards in IE10
当我应用此代码并在Internet Explorer和FireFox中对其进行测试时,单击时页面不会使用切换功能向下滚动,但是在关闭叠加层后页面会向上滚动。 这在Google Chrome浏览器中工作正常,但在IE 10或Firefox中却不能。 请帮忙。 :)
$(document).ready(function(){
$(".PlaceHolders").click(function(e){
e.preventDefault();
$(".overlay").slideToggle(2000, function(){
$("#url_placeholder").text($(this).is(':visible') ? "Close Components" : "View Available Components");
});
$('html','body').animate({scrollTop: $(".PlaceHolders").offset().top}, 2000);
});
这只是您的选择器。 参见http://codepen.io/anon/pen/MYNZzW
$('html,body').animate({scrollTop: $(".PlaceHolders").offset().top}, 2000);
希望这就是您想要的。 这是一个正在工作的小提琴,经过了chrome和ie10测试,
$(document).ready(function(){
$(".PlaceHolders").click(function(e){
$(".overlay").slideToggle("slow", function() {
setTimeout(function(){
$("#url_placeholder").text($(this).parent(".overlay").is(':visible') ? "Close Components" : "View Available Components");
},500);
});
$("html, body").animate({ scrollTop: $("#url_placeholder").offset().top }, 1000);
e.preventDefault();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.