我知道我可以使用$ .data,但是如何迭代遍歷所有data-
屬性並將這些值與默認插件配置合併?
(function($){
$.fn.plugin = function(opts){
opts = $.extend({
foo: 'abc',
boo: 45
}, opts);
return this.each(function(){
...
});
};
})(jQuery);
所以,如果我用
$('.el').plugin();
應該找數據屬性上.el
,像數據富等..