Skip to content

Commit

Permalink
Don't bind click on bg on initElts, do it on afterShowCont callback. Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nyroDev committed Oct 15, 2014
1 parent 3864084 commit cb6b4c0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/jquery.nyroModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,6 @@ jQuery(function($, undefined) {
},
initElts: function(nm) {
nm.elts.bg.addClass('nyroModalBg');
if (nm.closeOnClick)
nm.elts.bg.off('click.nyroModal').on('click.nyroModal', function(e) {
e.preventDefault();
nm.close();
});
nm.elts.cont.addClass('nyroModalCont');
nm.elts.hidden.addClass('nyroModalCont nyroModalHidden');
nm.elts.load.addClass('nyroModalCont nyroModalLoad');
Expand All @@ -877,6 +872,13 @@ jQuery(function($, undefined) {
nm.close();
});
},
afterShowCont: function(nm) {
if (nm.closeOnClick)
nm.elts.bg.off('click.nyroModal').on('click.nyroModal', function(e) {
e.preventDefault();
nm.close();
});
},
keyHandle: function(nm) {
// used for escape key
if (nm.keyEvent.keyCode == 27 && nm.closeOnEscape) {
Expand Down

0 comments on commit cb6b4c0

Please sign in to comment.