David
David

Reputation: 4777

resize padding-top of div using jqueryui/jquery

I have a div with a top padding of 140px. I want to resize the top padding to 30px. How can I do this and have a smooth animation with jqueryui/jquery?

Upvotes: 2

Views: 3507

Answers (2)

Sarfraz
Sarfraz

Reputation: 382806

Something like this:

$('#divID').animate({paddingTop: '30px'});

Upvotes: 2

dmcnelis
dmcnelis

Reputation: 2923

$('#divid').animate({ padding-top: 30px }, 5000, function() { //on completefunction });

In the above, the first {} is a list of CSS properties to animate into. The second argument is the number of milliseconds the animation should take, the function() is a call to be made when the animation is complete.

You could change the time to execute from 5000 to something larger or smaller depending on how long you want the animation to take.

Upvotes: 1

Related Questions