diff --git a/js/main.js b/js/main.js index 9fb5415c..ed89826e 100644 --- a/js/main.js +++ b/js/main.js @@ -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); diff --git a/js/module.js b/js/module.js index ab0f8ad3..9be652bf 100644 --- a/js/module.js +++ b/js/module.js @@ -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. */