开发者

Can I attach more than one functions to Document.Load using jQuery?

I am planning on separating independent .js files and I wonder if I can use them together after that.

The problem might be that all of them have something similar to

$(function() { code here };

Is it safe to make jQuery to run multiple times, from different locatio开发者_C百科ns, this method?


If you are using many .js files you might want to use require.js (http://requirejs.org/). This framework will optimize the loading of multiple scripts.


Yep, that should be fine. And you can reuse document.ready() too (info from jQuery docs here).


YES

I see no reason why wouldn't you be able to "run" jQuery multiple times.. It's function and function is about to be albe to be called multiple times


Yes. .ready(callback) is shorthand for .bind("ready", callback);. Event bind calls in jQuery let you add multiple handlers for a single event.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜