jQuery scrollTop not working in Chrome but working in Firefox

jquery, jquery-selectors, jquery-ui

Solution

Try using `$("html,body").animate({ scrollTop: 0 }, "slow");`

This works for me in chrome.

Problem

I have used a `scrollTop` function in jQuery for navigating to top, but strangely 'the smooth animated scroll' stopped working in Safari and Chrome (scrolling without smooth animation) after I made some changes. But it is still working smoothly in Firefox. What could be wrong? Here is the jQuery function I used, jQuery: ``` $('a#gotop').click(function() { $("html").animate({ scrollTop: 0 }, "slow"); //alert('Animation complete.'); //return false; }); ``` HTML ``` <a id="gotop" href="#">Go Top </a> ``` CSS ``` #gotop { cursor: pointer; position: relative; float: right; right: 20px; /*top:0px;*/ } ```

Original source

Related problems