dimanche 1 mars 2015

addEventListener should run constantly a function to get width of an object


When you click on the rectangle, it shrinks to become a logo. Now I want to unhide the content div when the welcome div is at ~75px width. I can't figure it out how to contantly run a function when you click the mousebutton.


Please help


html



<div id="introscreen">
<div id="welcome"></div>
<p id="help">Zum beginnen auf Rechteck klicken und halten</p>
</div>
<div class="content">
<header>
<p id="line">HALLOHALLO</p>
</header>
</div>


javascript



var counter = 0;
document.addEventListener("click", function () {
counter++;
check();
console.log(counter);
}, false);

function check() {
if (counter > 5) {
document.getElementById("help").style.opacity = '1.00';
}
}
document.addEventListener("mousedown", fadeAway, false);
document.addEventListener("click", showContent, false);

function fadeAway() {
document.getElementById("help").style.opacity = '0.00';
var position = $("#welcome").css("width");
console.log(position);
}


JSFIDDLE





Aucun commentaire:

Enregistrer un commentaire