Smooth Scrolling To Anchor Alongside Jquery
Just updated this i time again in addition to added pushState in, in addition to hence that it keeps rail of the hash alter inwards modern browsers. If a user clicks away later on clicking your anchor link, it’ll conduct hold them dorsum to the anchor reach they were at instead of making them rescroll to that position. Alternative 2 HTML <a href="#target" class="scrollMe">Go to </a> <div id="target">Lorem Ipsum...</div> Jquery $('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 - xx }, 1000); furnish false; ...