Reputation: 656
CSS
.bxspace{height: 258px;}
jQuery
$('.bxspace').height( $('.bxspace').height() + 15 );
This is my code with the function to get the bxspace
height and add 15px
when click. But I want to apply animate() to move it smoothly when adding 15px
. Tried below qjQuery but not working.
var height = $('.bxspace').height( $('.bxspace').height() + 15 );
$('.bxspace').animate({height: height+'px'});
I'm newbie in jQuery and I'm not sure how to combine both of these code. Hoping that some of you could provide me with some advice. Thanks!
Upvotes: 0
Views: 21
Reputation: 171669
You can use incremental syntax in animate()
for properties that accept numeric values
Try:
$('.bxspace').animate({height: "+=15"});
Upvotes: 1