I have a small piece of code, for example:
$("div.footerMenu li").click( function () { $("div.onScreen").hide(); $(this).children("div.onScreen").fadeIn('fast'); },function(){ $("div.onScreen").hide(); });
And when I click on <li> , the div.onScreen displays well, but when I click on this div, I just found that the functions are hidden and displayed again, but I do not want it to execute this function again. So my question is: how can I somehow "separate / exclude / hide" this div from Javascript?
update:
The fact is that with the help of this method and with others with .one () the rest of the menu does not work. There is a website with a problem here . I want this div to appear there when I click on it, but when I click on their <li> elements, I want other divs (submenus) to be displayed (warning - large images on this site).
html looks like this:
<div class="footerMenu"> <ul> <li>HOME<div class="onScreen"><div style="padding:50px;"><img src="fillTxt.png"></div></div></li> <li>PLENER<div class="onScreen"> <div style="padding:50px;"><img src="fillTxt2.png"></div></div> </li> <li>STUDIO<div class="onScreen"> <div style="padding:50px;"><img src="fillTxt.png"></div></div> </li> <li>INNE<div class="onScreen"> <div style="padding:50px;"><img src="fillTxt2.png"></div></div> </li> </ul> </div>
source share