How to scroll to element cross browser using jquery animate
问题 This code: jQuery('body').animate({scrollTop: target.offset().top}, 300); Works in firefox, but not chrome. This code: jQuery('html').animate({scrollTop: target.offset().top}, 300); Works in chrome, but not firefox. I haven't tested yet in IE. What is the correct way to do this, cross-browser? If it's not clear from the above snippets, I target is a div on the page, and I want to scroll down slowly to it slowly, so they do exactly what I want... just not cross-browser. 回答1: Specify both html