Skip to content

Commit f693ac6

Browse files
committed
Merge pull request BrandwatchLtd#3 from ingdir/reinit-on-animation
New request for an overlay to be displayed is not ignored while close animation is running
2 parents aacc40a + 9387e37 commit f693ac6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/toolbox/toolbox.expose.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,22 @@
6262
if (fn) { return fn.call($.mask); }
6363
}
6464

65-
var mask, exposed, loaded, config, overlayIndex;
65+
var mask, exposed, loaded, config, overlayIndex,
66+
closingNow = false;
6667

6768

6869
$.mask = {
6970

7071
load: function(conf, els) {
7172

73+
if (closingNow && mask) {
74+
// this calls the fadeOut callback
75+
// and sets closingNow to false
76+
mask.finish();
77+
}
78+
7279
// already loaded ?
73-
if (loaded) { return this; }
80+
if (loaded) { return this; }
7481

7582
// configuration
7683
if (typeof conf == 'string') {
@@ -169,11 +176,13 @@
169176
// onBeforeClose
170177
if (call(config.onBeforeClose) === false) { return this; }
171178

179+
closingNow = true;
172180
mask.fadeOut(config.closeSpeed, function() {
173181
call(config.onClose);
174182
if (exposed) {
175183
exposed.css({zIndex: overlayIndex});
176-
}
184+
}
185+
closingNow = false;
177186
loaded = false;
178187
});
179188

0 commit comments

Comments
 (0)