Skip to content
A jQuery plugin which enables slideUp and slideDown to be controlled via a speed number rather than time. i.e. taller elements take longer to slide
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
demo
.DS_Store
.gitignore
readme.md
slidespeed.js
slidespeed.min.js

readme.md

slideSpeed

slideSpeed allows you to control elements sliding up or down with a set speed rather than a timing. This means taller elements take longer to slide - more representative of their size.

The speed is in pixels per second - best bet is to have a play around and see what you prefer.

This plugin is used instead of jQuery's .slideDown(), .slideUp() or .slideToggle()

for example:

$('div').slideSpeed();

The slideSpeed() plugin can take 3 parameters:

$('div').slideSpeed({
    speed: 500, //the speed
    slide: 'down', //can be up, down or toggle.
    callback: function(){} // gets fired once the element has done its thing
});

The values listed in the example above are the defaults for the plugin.

TO give you an idea of speed and time, the following results were conducted

For a div with a height of 600px - I achieved the following results:

Speed (pixels per second) Time (ms)
200 3000
500 1200
800 800
Something went wrong with that request. Please try again.