I am totally new to jquery and I need to migrate some code from YUI to jquery. Need some help to start off with this.Ple开发者_运维知识库ase help translating the following piece of YUI code to jquery.
for ( var i = 0; i < objs.length; i++) {
var o = objs[i];
(function(obj, args, type, fn) {
YAHOO.util.Event.on(obj, type, function() {
fn.run(obj, args)
});
})(o.obj, o.args, this._type, this);
}
Thanks
This inner part of you code:
YAHOO.util.Event.on(obj, type, function() {
fn.run(obj, args)
});
should most likely be replaced with:
$(obj).bind(type, function() {
fn.run(obj, args);
});
But the code largely depends on the data supplied as obj
and type
. You should read this jQuery documentation about event types.
精彩评论