Tag Archive: scrolling

Jun 30

Attach .scroll() to AJAX loaded content

If you need to listen for a scroll event on AJAX loaded content that is not the window.scroll or document.scroll you may have realized that the .scroll() event does not bubble. All hope is not lost, you can still achieve this (especially if you are needing to do it with an element with overflow:auto; or …

Continue reading »

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 »