0

I am using jQuery.scrollTo in order to reach a certain DOM element w/ an easing effect. The plugin always worked like a charm in every browser.

Yesterday I noticed it didn't work on Chrome 34, and as I inspected the plugin I found it uses $.animate, so I reduced the problem to this fiddle:

$('body').animate({'scrollTop': 300}, 200)

Curiously enough, everything works fine on Chrome Canary [and all other major browsers].

This question didn't help either.

Is it a known bug of current Chrome version [which is supposed to be fixed on Canary]? I will fallback to plain anchors + ids in case.

Community
  • 1
  • 1
moonwave99
  • 21,957
  • 3
  • 43
  • 64
  • 1
    Not sure but you can try: `$('html, body').animation({'scrollTop': 300}, 200)`, it works on my Chrome browser (34.0.1847.116). I think in the other post, the problem is a load order problem, if the script is executed before the whole html page is rendered, you got problem with `$(...).offset().top`. – Holt Apr 17 '14 at 09:36
  • @Holt you got it man, thank you! Write is as an answer and I will mark as accepted ^^ – moonwave99 Apr 17 '14 at 09:41

1 Answers1

0

You can try this :

$('html, body').animation({
    scrollTop: 300
}, 200);

It is what I use on my sites and it works well in Chrome (34.0.1847.116).

Considering the other post you pointed, the problems probably comes from the load order : The script is executed before all the post are rendered, so $().offset().top returns something incorrect.

Holt
  • 36,600
  • 7
  • 92
  • 139