We use the jQuery slideDown function when animating elements on a page. A problem we have is that the animation takes a set time, regardless of how tall the element is.
If the element is 100 pixels high the animation appears to be a lot slower than if the element is 1000 pixels high as both animations will happen in the same amount of time.
Is there a way to animate the element that is measured in pixels per second (or some similar metric)?
You can set the duration of
.slideDown()with its first argument, which is a number in milliseconds.slideDown(time). Therefore, if you have a set speed (pixels per millisecond) and divide the element height.height()by it, then such operation should return the time that the animation should take. This way, in any given element with any given height, the function will scroll down at the same velocity.