簡體   English   中英

jQuery的animate scrolltop()不在IE10中向下滾動

[英]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();
});

});

http://jsfiddle.net/adhegde001/8uf9pvqw/1/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM