Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Smooth Scrolling
- $(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;
- }
- }
- });
- });
- https://github.com/davist11/jQuery-One-Page-Nav
- A lightweight jQuery plugin for the navigation on one-page sites. Adds smooth scrolling when clicking on the navigation and automatically selects the correct navigation items as you are scrolling through the different sections.
- The plugin still works even if you add additional content to the page after the fact that changes the position of each section.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement