This time I will share jQuery Plugin and tutorial about jQuery Plugin For One Page Scroll Navigation – Menu Anchor, hope it will help you in programming stack.
Menu Anchor is a jQuery plugin that automatically generates sticky anchor links which allow you to scroll smoothly through different sections on the vertical one-page scrolling website. Licensed under the Apache License.
How to use it:
1. Add a list of navigation items to the webpage.
1 |
< nav id = "container" class = "anchor-menu" > |
4 |
< li id = "menu-anchor-section1" >< a href = "#" >Section 1</ a ></ li > |
5 |
< li id = "menu-anchor-section2" >< a href = "#" >Section 2</ a ></ li > |
6 |
< li id = "menu-anchor-section3" >< a href = "#" >Section 3</ a ></ li > |
2. Add content sections with corresponding IDs to the webpage as displayed below.
01 |
< div id = "menu-anchor-section1-content" > |
05 |
< div id = "menu-anchor-section2-content" > |
09 |
< div id = "menu-anchor-section3-content" > |
3. Add jQuery JavaScript library and the jQuery Menu Anchor plugin to the webpage.
1 |
< script src = "//code.jquery.com/jquery-1.11.3.min.js" ></ script > |
2 |
< script src = "jquery.menu-anchor.min.js" ></ script > |
4. Initialize the plugin to generate a sticky navigation containing anchor links for your one page scrolling website.
1 |
$( '#container' ).MenuAnchor(); |
5. Style the One Page Scroll Navigation whatever you like.
05 |
-webkit-box-shadow: 2px 2px 5px rgba( 0 , 0 , 0 , 0.2 ); |
06 |
-moz-box-shadow: 2px 2px 5px rgba( 0 , 0 , 0 , 0.2 ); |
07 |
box-shadow: 2px 2px 5px rgba( 0 , 0 , 0 , 0.2 ); |
20 |
border-bottom : 1px solid rgba( 0 , 0 , 0 , 0.3 ); |
21 |
border-top : 1px solid rgba( 255 , 255 , 255 , 0.2 ); |
24 |
background : -moz-linear-gradient( top , #a90329 0% , #8f0222 44% , #6d0019 100% ); |
26 |
background : -webkit-gradient(linear, left top , left bottom , color-stop( 0% , #a90329 ), color-stop( 44% , #8f0222 ), color-stop( 100% , #6d0019 )); |
28 |
background : -webkit-linear-gradient( top , #a90329 0% , #8f0222 44% , #6d0019 100% ); |
30 |
background : -o-linear-gradient( top , #a90329 0% , #8f0222 44% , #6d0019 100% ); |
32 |
background : -ms-linear-gradient( top , #a90329 0% , #8f0222 44% , #6d0019 100% ); |
34 |
background : linear-gradient( top , #a90329 0% , #8f0222 44% , #6d0019 100% ); |
41 |
list-style-type : none ; |
49 |
text-decoration : none ; |
56 |
border-bottom :
source : jqueryscript.net
|