开发者

Translating YUI to jQuery functionality

开发者 https://www.devze.com 2023-03-16 08:52 出处:网络
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.

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.

0

精彩评论

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