diff --git a/index.html b/index.html index 09468be..7614074 100644 --- a/index.html +++ b/index.html @@ -86,6 +86,8 @@ WhatColorIsIt.prototype.spectrum = function(today) { var tomorrow = today + 86400000; var increment = (tomorrow - today) / this.spectrumDiv.offsetWidth; + this.spectrumDiv.innerHTML = ''; + for(var i = today; i < tomorrow; i += increment) { color = document.createElement('div'); color.style.background = this.toColor(new Date(i)); @@ -117,6 +119,13 @@ WhatColorIsIt.prototype.process = function(d) { WhatColorIsIt.prototype.run = function() { this.spectrum(Date.today()); + window.addEventListener('resize', function() { + if(typeof resizewait != 'undefined') { + clearTimeout(resizewait); + } + resizewait = setTimeout(function() { this.spectrum(Date.today()); }.bind(this), 200); + }.bind(this)); + this.start(); }; WhatColorIsIt.prototype.start = function() {