-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
22 lines (16 loc) · 923 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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.