开发者

jQuery plugin access

I'm doing a youtube player in jQuery, and I make this as a jQuery plugin, ex:

 $.fn.extend({

        uplayList: {},

        CreateUplayList: function (options) {
            this.each(function  () {
                $(this).uplayList = new $.playList(this, options);
           开发者_开发问答 });
        }
    });

But, if I do:

$('#playlist').CreateUplayList({....});

And I want access at the instance:

$('#playlist').uplayList.play();

This not work, that make sense, because $('#playlist') is a selector. I see in others plugins something like that:

$('#playlist').pluginname('play');

How can I apply this??


See the "Adding Methods to a Widget" section of the "Stateful Plugins" section of the jQuery Plugin Authoring Guide.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜