Skip to content

Commit

Permalink
Merge pull request #139 from mkorablin/master
Browse files Browse the repository at this point in the history
Check if animation properties are set on close
  • Loading branch information
geekjuice committed Nov 8, 2015
2 parents 1452a0e + 648c677 commit bc33130
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion coffee/vex.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ vexFactory = ($) ->
$('body').trigger 'vexAfterClose', options # Triggered on the body since $vexContent was removed
options.afterClose $vexContent, options if options.afterClose

if animationEndSupport
hasAnimation = $vex.css('animationName') != 'none' && $vex.css('animationDuration') != '0s'

if animationEndSupport && hasAnimation
unless beforeClose() is false
$vex
.unbind(vex.animationEndEvent).bind(vex.animationEndEvent, -> close())
Expand Down
2 changes: 1 addition & 1 deletion js/vex.combined.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions js/vex.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
return true;
},
closeByID: function(id) {
var $vex, $vexContent, beforeClose, close, options;
var $vex, $vexContent, beforeClose, close, hasAnimation, options;
$vexContent = vex.getVexByID(id);
if (!$vexContent.length) {
return;
Expand All @@ -137,7 +137,8 @@
return options.afterClose($vexContent, options);
}
};
if (animationEndSupport) {
hasAnimation = $vex.css('animationName') !== 'none' && $vex.css('animationDuration') !== '0s';
if (animationEndSupport && hasAnimation) {
if (beforeClose() !== false) {
$vex.unbind(vex.animationEndEvent).bind(vex.animationEndEvent, function() {
return close();
Expand Down
Loading

0 comments on commit bc33130

Please sign in to comment.