Permalink
Browse files

Don't bind click on bg on initElts, do it on afterShowCont callback. …

…Fix #176 #149
  • Loading branch information...
1 parent 3864084 commit cb6b4c073fa07fd700a059c023d9283d7168daeb @nyroDev committed Oct 15, 2014
Showing with 7 additions and 5 deletions.
  1. +7 −5 js/jquery.nyroModal.js
@@ -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');
@@ -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) {

0 comments on commit cb6b4c0

Please sign in to comment.