Sticky scrolling is when the navigation will stick to the browser during the scrolling process to achieve the effect of convenient website page browsing, which is also a user experience. This article mainly introduces the sticky scrolling navigation bar effect implemented by jQuery, involving the jQuery plug-in The related usage skills of smint are provided with complete example source code for readers to download and refer to. Friends who need it can refer to it. I hope it can help everyone.
Let’s take a look at how it is implemented:
jQuery’s smint plug-in is also a navigation menu fixed plug-in. When the page scrolls, the navigation menu will be fixed at the top; when the menu is clicked, the page will smoothly scroll to the corresponding area.
Compatibility
Because smint uses position: fixed, it is not compatible with IE6. Applicable browsers: IE8, 360, FireFox, Chrome, Safari, Opera, Maxthon, Sogou, Window of the World.
Introducing files
HTML
Home Section 1 Section 2 Section 3 Section 4 Section 5
Section 1
Section 2
Section 3
Section 4
Section 5
Note: Menu The external container (such as the subMenu in the above example) needs to set the style position:absolute, and the a tag of each menu needs to set an id. The value of the id is consistent with the value of the class in the corresponding area below.
JavaScript
$(function() { $('.subMenu').smint({ scrollSpeed : 1000 }); });
Related recommendations:
JavaScript to implement personalized navigation bar special effects
The above is the detailed content of Sticky scrolling navigation bar effect implemented by jQuery. For more information, please follow other related articles on the PHP Chinese website!