开发者

How do I use jQuery's .animate method with min-height?

开发者 https://www.devze.com 2023-02-22 13:11 出处:网络
I am trying to use min-height with jQuery.animate like this: $insert.animate({ min-height : 52 }, 1000).animate({ opacity : 1 }, 1000);

I am trying to use min-height with jQuery.animate like this:

$insert.animate({ min-height : 52 }, 1000).animate({ opacity : 1 }, 1000);

but it breaks 开发者_开发知识库the script. If i use height : 52 it works. Any ideas?

edit: see demo


Try wrapping min-height in quotes:

$insert.animate({ 'min-height' : 52 }, 1000).animate({ opacity : 1 }, 1000);

I should add: I'm assuming $insert is a pointer to a block element, i.e. $insert = $('#insert'), where #insert is an HTML element with display: block. I tried my solution in JSFiddle too.


$insert.animate({'min-height':'500px'}, 1000);

This is correct syntax using jQuery 1.7

0

精彩评论

暂无评论...
验证码 换一张
取 消