jQuery scrollTop not working in chrome but working in Firefox

Posted by Maju on Stack Overflow See other posts from Stack Overflow or by Maju
Published on 2010-06-15T05:08:51Z Indexed on 2010/06/15 5:12 UTC
Read the original article Hit count: 636

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 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;*/
    }

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui