我试图使用min-height
与jQuery.animate这样的:如何使用带有最小高度的jQuery的.animate方法?
$insert.animate({ min-height : 52 }, 1000).animate({ opacity : 1 }, 1000);
,但它打破了脚本。如果我使用height : 52
它的作品。有任何想法吗?
编辑:see demo
我试图使用min-height
与jQuery.animate这样的:如何使用带有最小高度的jQuery的.animate方法?
$insert.animate({ min-height : 52 }, 1000).animate({ opacity : 1 }, 1000);
,但它打破了脚本。如果我使用height : 52
它的作品。有任何想法吗?
编辑:see demo
尝试在引号包裹min-height
:
$insert.animate({ 'min-height' : 52 }, 1000).animate({ opacity : 1 }, 1000);
我要补充:我假设$insert
是一个指向一个块级元素,即$insert = $('#insert')
,其中#insert
是一个HTML元素与display: block
。我试过我的解决方案in JSFiddle too。
它以某种方式转换为'height:0px'。看起来像它不明白 – Patrioticcow 2011-04-05 21:24:02
我给我的答案增加了一些新的假设,你的代码是否匹配? – 2011-04-05 21:26:22
见http://jsfiddle.net/patrioticcow/hh8Q8/1/。它应该动画到'.test'的大小 – Patrioticcow 2011-04-05 21:42:21
$insert.animate({'min-height':'500px'}, 1000);
使用jQuery 1.7
这是正确的语法为最低高度之前,想要进行动画设置它?我不完全确定你为什么想要动画那个属性。 – 2011-04-05 21:19:29
我必须插入一个元素并在特定的高度将其设置为动画,如果这个元素内部出现了可以更大或更小的图片,我希望元素自动调整大小,最小高度为 – Patrioticcow 2011-04-05 21:22:01
但是它是什么动画从?同样,是否有一个以前设定的最小高度值? – 2011-04-05 21:24:17