ignaty
ignaty

Reputation: 535

Google Chrome page reloading on OSX

I am experiencing very strange Google Chrome behavior.

In my JavaScript I have scrollTo on page load that scrolls to particular part.

The code is simple as:

$('body').animate({ scrollTop: $('nav ul').position().top }, 1000);

But the problem is that when it scroll the page Google Chrome reload the page and that JavaScript is not firing again.

Maybe some one experiencing that before and have a solution or an idea why that is happening?

Thank you!

P.S. forgot to give an live example (do not take as advertising) - csspandemic.com

P.P.S. As people suggested it is working fine on Windows and happening only on OSX. (I changed the title.)

Upvotes: 1

Views: 340

Answers (1)

int3
int3

Reputation: 13201

Looks like it's a bug in Chrome: http://crbug.com/61674. Chrome isn't reloading the page -- it's restoring the scroll position to where it was the last time the page was loaded. If you scroll to a different position in the page and then refresh, you will see that the jump is to that last position; conversely, if you load the page in incognito mode, it works fine, because there isn't any cached scroll position.

Unfortunately, I'm not aware of a good workaround for this. I tried changing location.hash in an attempt to invalidate the cached scroll position, but to no avail.

Upvotes: 1

Related Questions