Trigger without click?
I'd like to run a scroll function:
$("body").scrollTo({ top: "0px", left: "2200px" }, 800);
...without any manual (click) tr开发者_开发知识库igger, so basically it should run on load. is it possible?
Eh? Not quite sure what you're asking. You can programatically trigger a click without the user having to physically click his mouse by calling .trigger('click')
on the element in question.
If you just want to the scroll to occur immediately, wrap it in $(document).ready(function() { ... });
Try adding .load()
$("body").load().scrollTo({ top: "0px", left: "2200px" }, 800);
jsfiddle Demo
精彩评论