javascript - jQuery if condition for two element mouseleave -


hereis code , online jsfiddle:

<div class="blocka"></div> <div class="blockb"></div> 
$(".blocka").mouseenter(function(){      $(".blockb").show(); }); $(".blocka").mouseleave(function(){      $(".blockb").hide(); }); 

my question is possible have if $(".blocka") or $(".blockb") mouseleave hide $(".blockb")

i tried following doesn't work :

$(".blocka" || ".blockb" ).mouseleave(function(){      $(".blockb").hide(); }); 

you can multiple selections using comma ,:

$(".blocka, .blockb").mouseenter(function(){      $(".blockb").show(); }); $(".blocka, .blockb").mouseleave(function(){      $(".blockb").hide(); }); 

updated fiddle:
http://jsfiddle.net/jauny/3/


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -