user3142695
user3142695

Reputation: 17362

JQuery slide effect with speed instead of duration

I tried to slideUp every div with the same speed (not duration), so that a bigger div takes more time than a smaller one.

But as you can see here (http://jsfiddle.net/4AdRH/11/) the small one (100px) slides up faster then the bigger one for the last 100px.

JS:

var msPerPixel = 4;
$('#div1').slideUp($('#div1').height() * msPerPixel);
$('#div2').slideUp($('#div2').height() * msPerPixel);

Upvotes: 1

Views: 70

Answers (1)

Evil Buck
Evil Buck

Reputation: 1068

As mentioned in the comments, possibly the easing is making it appear to not slide up at the same speed. Try specifying linear http://jsfiddle.net/evilbuck/4AdRH/12/

var msPerPixel = 4;
$('#div1').slideUp($('#div1').height() * msPerPixel, 'linear');
$('#div2').slideUp($('#div2').height() * msPerPixel, 'linear');

Upvotes: 1

Related Questions