Tag Archive: hashtag

Mar 20

Replace default hashtag scrolling in browser

Tired of the fluid-less jumps when going to a URL with a #hashtag? You can replace this using jQuery’s .scrollTo() method in the document.ready of your javascript. Here’s an example: $(document).ready(function() { if(window.location.hash) { $(‘html, body’).animate({ scrollTop: $(window.location.hash).offset().top }, 1000); } }); Now on page load this will fluidly scroll to the DOM element you’ve …

Continue reading »