0

I am trying to find a decent tutorial or code sample of how to achieve a common effect I see around the web. Essentially its having an element attach itself to the top of the window when it meets the element while scrolling. Quite frankly I have no idea what to call this functionality, or how to go about searching for the specifics of achieving it.

Here is on example, from the Twitter Bootstrap Docs. The bar under the heading & sub-heading will attach itself to the window as it scrolls past to help you navigate the page.

Another example is on the Android Developers Pages. The left side navigation element will attach itself to the window on scroll.

Any assistance in this is greatly appreciated.

Thanks in advance & cheers!

4

2 回答 2

5

查看jquery-waypointsSticky Elements Example

于 2012-07-26T19:01:43.517 回答
1

用于position:sticky粘性元素。

这是解释的文章。

http://updates.html5rocks.com/2012/08/Stick-your-landings-position-sticky-lands-in-WebKit

粘性位置演示

于 2012-09-14T10:44:10.897 回答