make datenspuren fun toggleable

This commit is contained in:
Astro 2011-09-16 02:11:18 +02:00
parent f4cfb7a1ce
commit 0993858522
3 changed files with 23 additions and 6 deletions

View File

@ -10,6 +10,7 @@ window.requestAnimFrame = (function(){
}; };
})(); })();
var funEnabled = false;
function now() { function now() {
return new Date().getTime(); return new Date().getTime();
@ -125,9 +126,27 @@ function stepClouds() {
}); });
}); });
if (funEnabled) {
requestAnimFrame(stepClouds, 'body'); requestAnimFrame(stepClouds, 'body');
} else {
clouds.forEach(function(cloud) {
cloud.el.detach();
});
clouds = [];
}
} }
$(document).ready(function() { $(document).ready(function() {
$('#cloudy-sun').click(function() {
funEnabled = !funEnabled;
if (funEnabled) {
var solar = $('<div id="solar"> </div>');
solar.hide();
$('#cloudy').append(solar);
$('#solar').fadeIn(1000);
setTimeout(stepClouds, 100); setTimeout(stepClouds, 100);
} else {
$('#solar').detach();
}
});
}); });

View File

@ -23,6 +23,7 @@ body {
margin-right: 3px; margin-right: 3px;
margin-left: auto; margin-left: auto;
border-radius: 100%; border-radius: 100%;
cursor: pointer;
} }
#aussicht { #aussicht {
background: url("../images/aussicht.png"); background: url("../images/aussicht.png");

View File

@ -43,10 +43,7 @@
</div> </div>
<div id="content"> <div id="content">
<div id="cloudy"> <div id="cloudy">
<div id="cloudy-sun"> <div id="cloudy-sun" title="Click here!">
<xsl:text> </xsl:text>
</div>
<div id="solar">
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
</div> </div>
</div> </div>