fix issue with show/hide callbacks

This commit is contained in:
Michael Teeuw 2016-04-08 17:27:02 +02:00
parent 0a19570f2c
commit 54dda91726
2 changed files with 7 additions and 2 deletions

View File

@ -162,7 +162,8 @@ var MM = (function() {
moduleWrapper.style.transition = "opacity " + speed / 1000 + "s";
moduleWrapper.style.opacity = 0;
setTimeout(function() {
clearTimeout(module.showHideTimer);
module.showHideTimer = setTimeout(function() {
// To not take up any space, we just make the position absolute.
// since it's fade out anyway, we can see it lay above or
// below other modules. This works way better than adjusting
@ -189,7 +190,8 @@ var MM = (function() {
moduleWrapper.style.position = "static";
moduleWrapper.style.opacity = 1;
setTimeout(function() {
clearTimeout(module.showHideTimer);
module.showHideTimer = setTimeout(function() {
if (typeof callback === "function") { callback(); }
}, speed);

View File

@ -17,6 +17,9 @@ var Module = Class.extend({
// Module config defaults.
defaults: {},
// Timer reference used for showHide animation callbacks.
showHideTimer: null,
/* init()
* Is called when the module is instantiated.
*/