Reputation: 1707
I'm using the following code for scrolling to top with the smooth animation. This works fine in Mozilla and IE browsers, but in chrome it is not working. Can any one please help.
$("#animate_top a").click(function(){
$("html").animate({scrollTop : 0},'slow');
});
I have added the sample url, click "click to reach bottom" and click the "top" link at the bottom in chrome, mozilla and ie.
http://www.sanatanapublications.org/demo/sample.html
Upvotes: 0
Views: 232
Reputation: 13937
For cross-browser scrolling, use this:
$('html,body')
If you set a callback on the animation, it will fire twice in IE so you need to use a conditional statement for IE in your HTML:
Then load a script file that sets it to only use the 'body' element.
Upvotes: 5
Reputation: 20269
Try it with $('body')
instead. If it still does not give the expected result, can you put up a public sample?
Upvotes: 4