标签:init == xtend jquery ons mys tor extend option
(function (factory) {
if (typeof define === ‘function‘ && define.amd) {
define([‘jquery‘], factory);
} else {
factory(jQuery);
}
}(function ($) {
function myShowOrHide($element, options) {
this.$element = $element;
this._defaults = {
size: 3,
status: ‘hide‘
};
this.options = $.extend({}, this._defaults, options || {});
this.init();
}
myShowOrHide.prototype = {
init: function () {
},
soh: function () {
}
}
};
$.fn.myShowOrHide = function (options, param) {
return this.each(function () {
var instance;
instance = $.data(this, ‘myShowOrHide‘);
if (!instance) {
instance = new myShowOrHide(this, options);
$.data(this, ‘myShowOrHide‘, instance);
}
if ($.type(options) === ‘string‘) {
return instance[options](param);
}
});
}
return this;
}));
标签:init == xtend jquery ons mys tor extend option
原文地址:https://www.cnblogs.com/zhoujiahong/p/11612435.html