A simple, lightweight JQuery plugin to add the slide-scroll effect to anchor links.
When you click on an anchor link, hashScroll will slide-scroll down the page to the target position.
hashScroll requires: JQuery & scrollTo
Include script after the jQuery library, be sure to include scrollTo as well:
<script src="/path/to/jquery.hashscroll.js"></script>
Using hashScroll is easy, simply call the function on the main container of your menu. hashScroll will automatically apply itself to any link starting with a "#".
$(function() {
$('.menuContainer').hashScroll();
});
<ul class="menuContainer">
<li><a href="#home">This will slide-scroll to home</a></li>
<li><a href="news.html">hashScroll will ignore this</a></li>
</ul>
Change how quickly or slowly the scroll occurs (default: 300).
$(function() {
$('.menuContainer').hashScroll({
scrollSpeed: 200
});
});