Search code examples
javascriptjqueryscrolltobrowser-historyjquery-address

On back button, why does Firefox jump straight to my previous scroll positions rather than animating


Please visit the demo: http://96.0.13.132

Click around for awhile, now hit the back button. In webkit browsers, you are animated back to the previous "state" while in Firefox you jump back. Why is this? How can I get Firefox to behave more like webkit?

I'm using jQuery, jQuery Address Plugin and jQuery ScrollTo Plugin.


Solution

  • I believe the problem was that I was scrolling to pages with an id that matched the hash and the default jump to id behavior was overriding my animations that were bound to the back button.

    For example, my link would be to "#about" and I had an element with an id of "about", so Firefox scrolled straight to it before I could animate a scroll to it. Changing the id of the element to "page_about" seemed to fix the problem.

    You can see the production site here: http://www.erny.com