jQuery百分比值在IE7中不起作用&;IE8

jQuery百分比值在IE7中不起作用&;IE8,jquery,internet-explorer,internet-explorer-8,internet-explorer-7,Jquery,Internet Explorer,Internet Explorer 8,Internet Explorer 7,请帮忙!我为#somediv创建了一个回调函数,最好使用百分比值使其在响应模板中正常工作,下面是我的代码: before: function(){ jQuery('#somediv').hide().animate({bottom:'100%'}); } after: function(){ jQuery('#somediv').show().animate({bottom:0}); } 不幸的是,上面的代码只在IE9中有效,如果我使用: before: function(){

请帮忙!我为#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});
}
任何帮助都将不胜感激


谢谢

为什么要隐藏然后设置动画?这是为了隐藏元素从上到下的移动。。有人只会看到从下到上的移动。耶!太好了。。非常感谢你的帮助!但是等一下,也许问起来会很尴尬,我真的很笨。。如何将其转换为负值,例如-100%?就像在数学中一样,乘以-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});
}