开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜