As a jQuery statement,
$(document).scrollTop(200);
works on Chrome. However,
$("body").scrollTop(200);
doesn't. Can I know the difference?
The document
and body
are different things.
document
refers to the current 'document' been loaded into the browser's tab.
This document contains everything there is for your page, the document also contains the body element inside it.
On the other hand the body is just a plain html element, a little bit special compared to a div
or a span
, but still it is only an element within the document.