diff --git a/src/jquery.sidebar.min.js b/src/jquery.sidebar.min.js index e0a812c..2862404 100644 --- a/src/jquery.sidebar.min.js +++ b/src/jquery.sidebar.min.js @@ -1 +1 @@ -(function($){$.fn.sidebar=function(options){var self=this;var width=self.outerWidth();var height=self.outerHeight();var settings=$.extend({speed:200,side:"left",range:{left:[-width,0],right:[-width,0],top:[-height,0],bottom:[-height,0]},closed:true},options);settings.range=settings.range[settings.side];this.on("sidebar:open",function(){var properties={};properties[settings.side]=settings.range[1];settings.closed=null;self.stop().animate(properties,settings.speed,function(){settings.closed=false;self.trigger("sidebar:opened")})});this.on("sidebar:close",function(callback){var properties={};properties[settings.side]=settings.range[0];settings.closed=null;self.stop().animate(properties,settings.speed,function(){settings.closed=true;self.trigger("sidebar:closed")})});this.on("sidebar:toggle",function(callback){if(settings.closed){self.trigger("sidebar:open")}else{self.trigger("sidebar:close")}});return this}})(jQuery); \ No newline at end of file +(function($){$.fn.sidebar=function(options){var self=this;if(self.length>1){return self.each(function(){$(this).sidebar(options)})}var width=self.outerWidth();var height=self.outerHeight();var settings=$.extend({speed:200,side:"left",range:{left:[-width,0],right:[-width,0],top:[-height,0],bottom:[-height,0]},closed:true},options);settings.range=settings.range[settings.side];this.on("sidebar:open",function(){var properties={};properties[settings.side]=settings.range[1];settings.closed=null;self.stop().animate(properties,settings.speed,function(){settings.closed=false;self.trigger("sidebar:opened")})});this.on("sidebar:close",function(callback){var properties={};properties[settings.side]=settings.range[0];settings.closed=null;self.stop().animate(properties,settings.speed,function(){settings.closed=true;self.trigger("sidebar:closed")})});this.on("sidebar:toggle",function(callback){if(settings.closed){self.trigger("sidebar:open")}else{self.trigger("sidebar:close")}});return this}})(jQuery); \ No newline at end of file