因此,它可以显示或隐藏这样:如何使用此功能实现jQuery插件?
$(selector).pluginName('show')
$(selector).pluginName('hide')
的问题是我怎么知道哪一个显示或隐藏?
我现在做这种方式:
$.fn.pluginName = function(opts) {
var conf = $.extend({},opts);
return this.each(function() {
if(conf && 'conf' == conf.type)
{
//ClassName is defined elsewhere
new ClassName(conf,$(this));
}
else
{
//**show or hide corresponding instance**
}
});
}
如果你正在*做*,我认为你需要'.toggle()'... – 2010-01-15 08:13:51