我写了一个插件与下面的“签名”:更轻松地调用自定义的jQuery插件
jQuery.fn.attach = function(element, settings, duration, options, callback) {
这里element
是一个jQuery对象,settings
是我的自定义设置为我的插件和duration
,options
和callback
是我在jQuery的动画使用的所有参数,如:
someObject.animate({ someCSS }, duration, options, callback);
现在,我的问题是:是否有可能使该功能更容易打电话?举例来说,现在,让一切工作,我希望......我必须包括所有参数和设置,我不使用null
参数:
$(this).attach($('#e1-blue'), null, 3000, null, function() { alert('done'); });
这将是很好也能够调用此为:
$(this).attach($('#e1-blue'), 3000, function() { alert('done'); });
,并为这个(OFC)...
$(this).attach($('#e1-blue'), 3000);
有什么建议?