jQuery Smooth Scrolling
Performs a smooth page scroll to an anchor on the same page.
In This Season I will Share a Tricks. Its How to Add jquery Smooth Scroll in Your Website. You Can Just Edit in Your Web Index Page. This Time Copy Just Below Syntax JavaScript Code. Double Click to Highlight this Code & [ CTRL+C ]
Now Open Your Index.html page & Edit this html File. Find [ CTRL+F ] This End </body> Tag, and Past This Code in on </body> Tag.
* Important: Must be this code in on </head> tag.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
Main Code:
$(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); });