jStick is a jQuery plugin which allows you to stick your navigation bar to the top of your page when you scroll down.
-
Just load jquery.jstick.js in your HEAD
-
Initialize the plugin on the element you want. For example :
$('#nav').jStick();
-
Add options if you want. See below...
-
Look at examples (index, index2 & index3.html) for inspiration ;)
* targetClass = the class attribute given to the element when stuck (default : 'stuck')
* cloneClass = the class attribute of the cloned element (default : 'the_clone')
* offset = the number of pixel of offset between the element and the top of the window (default : 0)
* limit = the height at which the element should no longer be stuck (default: false)
* cancelIfTooHigh = disable the plugin effect if the window is smaller than the element (to avoid that its bottom would never be seen) (default: true)
* onStick = a function fired when the element is stuck (default : null)
* onUnstick = a function fired when the element is unstuck (default : null)
* onLimitReached = a function fired when the limit parameter is reached (default : null)
* onFreeze = a function fired when the element is frozen (default : null)
* freeze = freeze the stuck element.
* unFreeze = if frozen, unfreeze the stuck element (and stick it).