(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof exports==="object"){module.exports=e(require("jquery"))}else{e(jQuery)}})(function(d){var p={init(e){var s=d(this);p.el=s;var a={placement:"left",width:"auto",closable:true,mask:true,maskClosable:true};d.extend(true,a,e||{});p.options=a;var t=s.addClass("drawer "+a.placement).children().remove();var r=d("<div>",{class:"drawer-mask"});s.append(r);if(a.mask){r.addClass("drawer-mask-show")}if(a.maskClosable){r.click(function(){p.close()})}var l=d("<div>",{class:"drawer-content",style:"width: "+a.width});s.append(l);if(a.closable||a.title){var i=d("<div>",{class:"drawer-content-header"});l.append(i);if(a.title){var o=d("<div>",{class:"drawer-content-title",text:a.title});i.append(o)}if(a.closable){var c=d("<div>",{class:"drawer-close",text:""});i.append(c);d(c).css("position","absolute").css("top","-15px").css("right","-10px").css("width","0px").css("height","30px").css("background-size","contain").css("background-image","url(img/close2.png)");c.click(function(){p.close()})}}var n=d("<div>",{class:"drawer-content-body"});t.appendTo(n);l.append(n);return p},open(){this.el.addClass("active");this._runCallback(this.options.afterOpenCallback);d(".drawer-mask").css("width","100%");d(".drawer-close").css("width","30px");console.log("open...")},close(){this.el.removeClass("active");this._runCallback(this.options.afterCloseCallback);d(".drawer-mask").css("width","0");d(".drawer-close").css("width","0");console.log("close...")},_runCallback(e){if(!e)return;if(typeof e==="function"){try{e()}catch(e){console.error("回调函数调用失败：",e)}}else{console.error("回调函数定义错误！")}}};d.fn.drawer=function(e){return p.init.call(this,e)}});