Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>For updated Question:</em> Since the mouse events won't occur on that smaller element (it's completely overlapped) you'd have to use a <em>third</em> <code>&lt;div&gt;</code> like this:</p> <pre><code>&lt;div class="block"&gt; &lt;div class="popup"&gt;&lt;/div&gt; &lt;div class="popup upper"&gt;&lt;/div&gt; &lt;div class="image"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>And add this CSS (note the higher <code>z-index</code> than the other <code>.popup</code>):</p> <pre><code>.upper { width: 100px; height: 100px; z-index: 41; } </code></pre> <p>and script to match:</p> <pre><code>$(".block .image").mouseenter(function(){ console.log($(this).siblings(".popup").length); $(this).siblings(".popup").show(); }); $(".block .upper").mouseleave(function(){ $(this).siblings(".popup").andSelf().hide(); }); </code></pre> <p><a href="http://jsfiddle.net/nick_craver/eQ8EJ/1/" rel="nofollow">You can test it out here</a>.</p> <hr> <p><em>For previous question:</em> Since the popup is over top of the element, use the <a href="http://api.jquery.com/mouseenter/" rel="nofollow"><code>mouseenter</code></a> on the trigger, <a href="http://api.jquery.com/mouseleave/" rel="nofollow"><code>mouseleave</code></a> on the popup, like this:</p> <pre><code>$(".block .image").mouseenter(function(){ $(this).siblings(".popup").show(); }); $(".block .popup").mouseleave(function(){ $(this).hide(); }); </code></pre> <p><a href="http://jsfiddle.net/nick_craver/eQ8EJ/" rel="nofollow">You can test it here</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload