Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h3>Modern Browsers</h3> <p>In modern browsers, you can leverage the <code>:hover</code> pseudo class in our selector. As an example, consider the following markup:</p> <pre class="lang-html prettyprint-override"><code>&lt;div class="item"&gt; &lt;p&gt;This is a long string of text&lt;/p&gt; &lt;div class="adminControls"&gt; &lt;a href="#" title="Delete"&gt;Delete Item&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>By default, we would want the <code>.adminControls</code> to be hidden. They should, however, become visible once the user has hovered the <code>.item</code> element:</p> <pre class="lang-css prettyprint-override"><code>.item .adminControls { display: none; } .item:hover .adminControls { display: block; } </code></pre> <h3>JavaScript and jQuery</h3> <p>If you're using <a href="http://www.jquery.com" rel="nofollow noreferrer">jQuery</a>, you can accomplish this rather easily using the $.hover() method. If you're using Prototype, you can get the <a href="http://code.google.com/p/protohover/" rel="nofollow noreferrer">protoHover plugin</a> to achieve the same result, or view <a href="http://www.zurielbarron.com/2009/01/30/jquery-hover-with-prototype/" rel="nofollow noreferrer">this blog post</a>.</p> <pre class="lang-js prettyprint-override"><code>$("div.item").hover( function () { $(this).find(".adminControls").show(); }, function () { $(this).find(".adminControls").hide(); } ); </code></pre> <p>That would accomplish the show/hide effect for the following:</p> <pre class="lang-html prettyprint-override"><code>&lt;div class="item"&gt; &lt;p&gt;This is a long string of text&lt;/p&gt; &lt;div class="adminControls"&gt; &lt;a href="#" title="Delete"&gt;Delete Item&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;p&gt;This is a long string of text&lt;/p&gt; &lt;div class="adminControls"&gt; &lt;a href="#" title="Delete"&gt;Delete Item&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;p&gt;This is a long string of text&lt;/p&gt; &lt;div class="adminControls"&gt; &lt;a href="#" title="Delete"&gt;Delete Item&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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