JS代码如下:
/**
* 简单的模板功能实例
*
* @param
* @arrange (512.笔记) jb51.cc
**/
var isJqueryObj = function(obj) {
return obj instanceof jQuery;
};
/**
* 构造函数
* @param {object} opts
*/
var WebDisk = function(opts) {
opts = $.extend({
"element": null //容器可以是JQ对象或样式名
},opts || {});
this.opts = opts;
if (isJqueryObj(opts.element)) {
this.element = opts.element;
} else {
this.element = $(opts.element);
}
this.init(); //初始化
};
$.extend(WebDisk.prototype,{
init: function() {
var elEl = this.element;
var opts = this.opts;
this.bindEvents(); //事件绑定
},bindEvents: function() {
var elEl = this.element;
elEl.on('click','.xxx',function() {
$(this).show();
});
},destroy: function() {
}
});
// 来自:编程之家 jb51.cc(jb51.cc)