This time I will share jQuery Plugin and tutorial about Sticky One Page Scroll Navigation With jQuery And CSS3, hope it will help you in programming stack.
Makes use of jQuery, CSS3 animations and flexbox model to create a sticky top navigation for your one page scroll websites, with support for scrollspy and smooth scroll.
How to use it:
1. Add sliding content to your one page scroll website as this:
01 |
< main class = "spa-main" > |
02 |
< section class = "spa-slide" id = "tab-1" > |
04 |
< h3 >This is section 1</ h3 > |
06 |
< section class = "spa-slide" id = "tab-2" > |
08 |
< h3 >This is section 2</ h3 > |
10 |
< section class = "spa-slide" id = "tab-3" > |
12 |
< h3 >This is section 3</ h3 > |
2. Create a navigation for the sliding content.
1 |
< section class = "sticky-nav-tabs" > |
3 |
< div class = "sticky-nav-tabs-container" > |
4 |
< a class = "sticky-nav-tab" href = "#tab-1" >Section 1</ a > |
5 |
< a class = "sticky-nav-tab" href = "#tab-2" >Section 2</ a > |
6 |
< a class = "sticky-nav-tab" href = "#tab-3" >Section 3</ a > |
7 |
< span class = "sticky-nav-tab-slider" ></ span > |
3. The required CSS/CSS3 styles for the sticky top navigation.
001 |
.sticky-nav-tabs, .spa-slide { |
002 |
display : -webkit-box; |
003 |
display : -ms-flexbox; |
005 |
-webkit-box-orient: vertical; |
006 |
-webkit-box- direction : normal ; |
007 |
-ms-flex- direction : column; |
008 |
flex- direction : column; |
009 |
-webkit-box-pack: center ; |
010 |
-ms-flex-pack: center ; |
011 |
justify- content : center ; |
012 |
-webkit-box-align: center ; |
013 |
-ms-flex-align: center ; |
022 |
.sticky-nav-tabs h 1 , .spa-slide h 1 { |
025 |
letter-spacing : 1 rem; |
028 |
.sticky-nav-tabs h 3 , .spa-slide h 3 { |
030 |
letter-spacing : 0.3 rem; |
034 |
.sticky-nav-tabs-container { |
035 |
display : -webkit-box; |
036 |
display : -ms-flexbox; |
038 |
-webkit-box-orient: horizontal; |
039 |
-webkit-box- direction : normal ; |
040 |
-ms-flex- direction : row; |
046 |
box-shadow: 0 0 20px rgba( 0 , 0 , 0 , 0.1 ); |
049 |
-webkit-transition: all 0.3 s cubic-bezier( 0.19 , 1 , 0.22 , 1 ); |
050 |
transition: all 0.3 s cubic-bezier( 0.19 , 1 , 0.22 , 1 ); |
053 |
.sticky-nav-tabs-container--top-first { |
056 |
-webkit-transition: all 0.3 s cubic-bezier( 0.19 , 1 , 0.22 , 1 ); |
057 |
transition: all 0.3 s cubic-bezier( 0.19 , 1 , 0.22 , 1 ); |
060 |
.sticky-nav-tabs-container--top-second { |
063 |
source : jqueryscript.net
|