Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions popbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -28,7 +28,7 @@
},

close: function(){
$(settings['box']).fadeOut("fast");
$(settings.box).fadeOut("fast");
}
};

Expand All @@ -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);