javascript - Firefox event firing issue -
i have list in markup connected event listener, each li contains 1 or 2 divs , idea stuff depending on div clicked. html sample:
<ul id="list"> <li><div class="first a"></div><div class="second b c"></div></li> <li><div class="first f"></div></li> <li><div class="first e"></div><div class="second d r"></div></li> … js sample:
var currentlang = 'en'; var failcounter = 0; var currentarg = args[math.floor(math.random() * args.length)]; var previousargs = []; function keyclicked(event) { if (event.target.classname.split(' ').indexof(currentarg) > -1) { textbox.style.opacity = 0; settimeout(function () { textbox.innerhtml = wonmessages[currentlang]; textbox.style.opacity = 1; wrapper.classname = 'alert alert-success wrapper-active'; }, 250); wrapper.onclick = function () { location.href = "…" }; list.removeeventlistener('click', keyclicked); } else { if (failcounter < 1) { failcounter++; previousargs.push(currentarg); { currentarg = args[math.floor(math.random() * args.length)]; } while (previousargs.indexof(currentarg) > -1); textbox.style.opacity = 0; settimeout(function () { textbox.innerhtml = wrongmessages[currentlang]; textbox.style.opacity = 1; wrapper.classname = 'alert alert-warning'; }, 250); } else { textbox.style.opacity = 0; settimeout(function () { textbox.innerhtml = lostmessages[currentlang]; textbox.style.opacity = 1; wrapper.classname = 'alert alert-danger'; }, 250); list.removeeventlistener('click', keyclicked); } } } list.addeventlistener('click', keyclicked); the problem while works fine in ie , chrome, firefox reason doesn't fire event when div of class first (the first 1 or 1 in li if li contains 1 div) clicked. firefox recognizes clicks on divs of class second. ideas, why? difference between browser leads that?
if may helpful — i've found solution. problem lied in css. divs should trigger event had negative z-index setting in :active state. turned out reason firefox refuses trigger events elements negative z-index.
Comments
Post a Comment