I am trying to create a plugin very that has similar usage to the jquery ui plugin for dialogs. The usage I am after looks like this
First, to set options for my plugin (with a default action) you could pass in params like this.
$('#myId').dialog({
value1 : 'someValue',
value2 : 'anotherValue',
//...
});
Also, I want to be able to wire-up specific events using "key words". For instance in jquery.UI you can call this to close a dialog
$('#myId').dialog('close');
My question is how do I setup my plugin so that it does one thing if it is being passed in the settings or it does other things depending on the keywords passed in? I tried looking at some of the jquery ui code but I'm not sure I understand what it's doing or even where to start to just pull out this functionality.