diff --git a/popbox.js b/popbox.js index 9c3cfb2..bb517ce 100644 --- a/popbox.js +++ b/popbox.js @@ -15,10 +15,10 @@ event.preventDefault(); var pop = $(this); - var box = $(this).parent().find(settings['box']); + var box = $(this).parent().find(settings.box); - box.find(settings['arrow']).css({'left': box.width()/2 - 10}); - box.find(settings['arrow_border']).css({'left': box.width()/2 - 10}); + box.find(settings.arrow).css({'left': box.width()/2 - 10}); + box.find(settings.arrow_border).css({'left': box.width()/2 - 10}); if(box.css('display') == 'block'){ methods.close(); @@ -28,7 +28,7 @@ }, close: function(){ - $(settings['box']).fadeOut("fast"); + $(settings.box).fadeOut("fast"); } }; @@ -39,19 +39,19 @@ }); $(document).bind('click', function(event){ - if(!$(event.target).closest(settings['selector']).length){ + if(!$(event.target).closest(settings.selector).length){ methods.close(); } }); return this.each(function(){ - $(this).css({'width': $(settings['box']).width()}); // Width needs to be set otherwise popbox will not move when window resized. - $(settings['open'], this).bind('click', methods.open); - $(settings['open'], this).parent().find(settings['close']).bind('click', function(event){ + $(this).css({'width': $(settings.box).width()}); // Width needs to be set otherwise popbox will not move when window resized. + $(settings.open, this).bind('click', methods.open); + $(settings.open, this).parent().find(settings.close).bind('click', function(event){ event.preventDefault(); methods.close(); }); }); - } + }; }).call(this);