Yesterday, I had a request. I wanted the page to automatically scroll to a certain position to the left after it is loaded.
I always thought that just setting a value to document.documentElement.scrollLeft on the page would take effect, but I was disappointed~
I took the time to check today and found out:
Use document.documentElement.scrollLeft to set the value. It must take effect when triggered by a human event;
If you want the page to automatically scroll a certain distance after loading, use jquery's animate, as in the following example:
$("html,body").animate( {"scrollLeft": "300px"}, 1000);
$("html,body").animate({"scrollTop": "300px"}, 1000);
demo: