Skip to content

Commit

Permalink
Listen animations of the wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
vodkabears committed May 24, 2015
1 parent 7c95b6e commit ca1c5a6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/remodal.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@
if (--runningAnimationsCount === 0) {

// Remove event listeners
$.each(['$bg', '$overlay', '$modal'], function(index, elemName) {
$.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS);
});

doAfterAnimation();
}
};

$.each(['$bg', '$overlay', '$modal'], function(index, elemName) {
$.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
instance[elemName]
.on(ANIMATIONSTART_EVENTS, handleAnimationStart)
.on(ANIMATIONEND_EVENTS, handleAnimationEnd);
Expand All @@ -358,11 +358,12 @@
if (
getAnimationDuration(instance.$bg) === 0 &&
getAnimationDuration(instance.$overlay) === 0 &&
getAnimationDuration(instance.$wrapper) === 0 &&
getAnimationDuration(instance.$modal) === 0
) {

// Remove event listeners
$.each(['$bg', '$overlay', '$modal'], function(index, elemName) {
$.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS);
});

Expand All @@ -380,7 +381,7 @@
return;
}

$.each(['$bg', '$overlay', '$modal'], function(index, elemName) {
$.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS);
});

Expand Down

0 comments on commit ca1c5a6

Please sign in to comment.