Skip to content

jQuery Plugin. Cause absolutely positioned elements to "bump" against the top of the window and stay there as the user scrolls

Notifications You must be signed in to change notification settings

aldenks/Stick-With

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Stick With takes absolutely positioned elements and changes them to 
  fixed position elements before they are about to scroll off the top
  of the page. When the user scrolls back up they become absolutely
  positioned again.
  
  This has the effect of the element scrolling with the page until it
  "bumps" up against the top of the viewport. It stays there until
  the page comes back down and grabs the element again.

Options: top - (optional) the minimum number of pixels the element should
               stay away from the top of the viewport. default: 0.

Usage:
 $('selector').stickWith( {top: 20} ); 
 //Selected elements must be absolutely positioned before stickWith is called

See a demo: http://www.eecs.tufts.edu/~asamps01/stickwith/demo.html

TODO: Resizing the window is not handled at all. The element will jump
  sideways as you scroll past the place where it should switch to absolute
  positioning.

About

jQuery Plugin. Cause absolutely positioned elements to "bump" against the top of the window and stay there as the user scrolls

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published