如何使用jquery animate滚动到元素跨浏览器

这段代码:

jQuery('body').animate({scrollTop: target.offset().top}, 300); 

适用于Firefox,但不适用于Chrome。

这段代码:

 jQuery('html').animate({scrollTop: target.offset().top}, 300); 

适用于chrome,但不适用于Firefox。

我还没有在IE中测试过。

跨浏览器的正确方法是什么? 如果从上面的片段中不清楚,我的目标是页面上的div,我想慢慢向下滚动到它,所以他们完全按照我想要的那样做…只是不跨浏览器。

同时指定htmlbody

 $("html,body").animate({scrollTop: target.offset().top}, 300);