0

助けてください!#somedivのコールバック関数を作成します。これは、パーセント値を使用してレスポンシブテンプレートで正しく機能するようにするのに適しています。コードは次のとおりです。

before: function(){
   jQuery('#somediv').hide().animate({bottom:'100%'});
}
after: function(){
   jQuery('#somediv').show().animate({bottom:0});
}

残念ながら、上記のコードはIE9でのみ機能し、次のコードを使用するとうまく機能します。

before: function(){
   jQuery('#somediv').hide().animate({bottom:400});
}
after: function(){
   jQuery('#somediv').show().animate({bottom:0});
}

どんな助けでもいただければ幸いです!

ありがとう!

4

1 に答える 1

1
before: function(){
   // no need for hidden animations just set the css
   // you cannot animate percents in jQuery as not all browsers will support it
   // using offset parent you can find use the real px height instead of a 100%
   jQuery('#somediv').hide().css({bottom: jQuery('#somediv').offsetParent().height() });
}
after: function(){
   jQuery('#somediv').show().animate({bottom:0});
}
于 2012-09-12T01:59:14.687 に答える