JacquesHille (Talk | contribs) |
JacquesHille (Talk | contribs) |
||
Line 45: | Line 45: | ||
/// Smooth Scroll: /// | /// Smooth Scroll: /// | ||
− | + | $('a[href*=#]:not([href=#])').click(function() { | |
− | $('a[href*= | + | 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) { | |
− | if ( | + | $('html,body').animate({ |
− | + | scrollTop: target.offset().top | |
− | + | }, 1000); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
return false; | return false; | ||
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | + | }); | |
/// End smoothscroll // | /// End smoothscroll // | ||
Revision as of 14:57, 15 October 2018