Reputation: 8497
Is it possible to assing a speed instead of a duration value to a JQuery slide effect, so that elements with different sizes open or close at the same speed?
$(this).slideUp( /* SPEED instead of DURATION */ );
Upvotes: 1
Views: 225
Reputation: 27022
I think this works... you can multiply the height of the item by some constant:
var constant = 4;
$('#div1').slideUp($('#div1').height() * constant);
$('#div2').slideUp($('#div2').height() * constant);
Adjust the constant to change the speed, but it will always be relative to the height of the element being animated.
Upvotes: 1