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.
精彩评论