jQuery Plugin For Sticky One Page Scroll Navigation - sKroll
| File Size: | 7.47 KB |
|---|---|
| Views Total: | 2561 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
sKroll is a very small jQuery plugin to create a sticky & auto-update navigation for your one page scroll website.
Features:
- Smooth scrolls to the target section.
- Adds an active class to the nav items when you scroll past their sections.
How to use it:
1. Include the jQuery sKroll plugin after you have jQuery loaded.
<script src="jquery.min.js"></script> <script src="skroll/sKroll.min.js"></script>
2. Create a navigation and content sections for your one page scroll website.
<div id="skroll">
<div class="skroll-header">
<ul>
<li class="skroll-active"><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About</a></li>
</ul>
</div>
<div class="skroll-content">
<section>
<h2>Home</h2>
</section>
<section>
<h2>Blog</h2>
</section>
<section>
<h2>Contact</h2>
</section>
<section>
<h2>About</h2>
</section>
</div>
</div>
3. Style the plugin.
body {
margin: 0;
padding: 0
}
#skroll { display: none }
.skroll-header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 50px;
background-color: #fff;
-webkit-box-shadow: 0 3px 11px -1px rgba(0,0,0,0.75);
-moz-box-shadow: 0 3px 11px -1px rgba(0,0,0,0.75);
box-shadow: 0 3px 11px -1px rgba(0,0,0,0.75)
}
.skroll-content section h2 { text-align: center }
.skroll-header ul { list-style-type: none }
.skroll-header ul li {
display: inline;
margin: 0 5px
}
.skroll-header ul li a {
color: #333;
text-decoration: none;
padding: 5px 10px;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out
}
.skroll-header ul li a:hover { color: #999 }
.skroll-header ul li.skroll-active a { color: #E74C3C }
.skroll-content {
width: 100%;
margin-top: 60px;
}
.skroll-content section {
width: 100%;
height: 100%;
float: left;
color:#fff;
}
.skroll-content section:nth-child(odd) { background-color: #34BC9D }
.skroll-content section:nth-child(even) { background-color: #DA4453 }
4. Call the plugin on top element and done.
$('#skroll').sKroll();
This awesome jQuery plugin is developed by dnlnwk. For more Advanced Usages, please check the demo page or visit the official website.











