Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay/Hide a div on JavaScript hover
    primarykey
    data
    text
    <p>I want the image overlay (with text) to only display when the div is hovered over. Hidden by default. By JavaScript if suitable.</p> <p>I tried duplicating the css, giving the first (display: none) and then the second with :hover and no (display: none), but did not work, so trying with JavaScript to add/remove the (display: none) class.</p> <p>I've included a live URL. I am reffering to the 6 homepage images. </p> <p><img src="https://i.stack.imgur.com/amdP0.jpg" alt="enter image description here"> <img src="https://i.stack.imgur.com/wjqTd.jpg" alt="enter image description here"></p> <p>Live URL: <a href="http://bit.ly/1jl1QaT" rel="nofollow noreferrer">http://bit.ly/1jl1QaT</a></p> <p>HTML</p> <pre><code>&lt;div class="desc"&gt;&lt;p&gt;&lt;?=((strlen($r_main['friendlyTitle'])&gt;40)?substr($r_main['friendlyTitle'],0,40).'...':$r_main['friendlyTitle']);?&gt;&lt;/p&gt;&lt;/div&gt; &lt;/div&gt;&lt;/a&gt; &lt;a href="Shopping/"&gt;&lt;div class="feature-2"&gt; &lt;div class="header"&gt;&lt;p&gt;Shopping&lt;/p&gt;&lt;/div&gt; &lt;div class="desc"&gt;&lt;p&gt;Grab yourself a pair of Mink Fur Eyelashes for only £19.95 &lt;/p&gt;&lt;/div&gt; &lt;/div&gt;&lt;/a&gt; </code></pre> <p>CSS</p> <pre><code>#content-mid .col-2 .features .feature-1 .desc, #content-mid .col-2 .features .feature-2 .desc, #content-mid .col-2 .features .feature-3 .desc, #content-mid .col-2 .features .feature-4 .desc, #content-mid .col-2 .features .feature-5 .desc, #content-mid .col-2 .features .feature-6 .desc { position:absolute; width: 220px; height: 50px zoom: 1; filter: alpha(opacity=90); opacity: 0.9; background: #333; bottom: 0; margin-bottom: 5px; display: none; } #content-mid .col-2 .features .feature-1 .desc, #content-mid .col-2 .features .feature-2 .desc, #content-mid .col-2 .features .feature-3 .desc, #content-mid .col-2 .features .feature-4 .desc, #content-mid .col-2 .features .feature-5 .desc, #content-mid .col-2 .features .feature-6 .desc-show { position:absolute; width: 220px; height: 50px zoom: 1; filter: alpha(opacity=90); opacity: 0.9; background: #333; bottom: 0; margin-bottom: 5px; } </code></pre> <p>JavaScript</p> <pre><code>$(".desc").hover( function () { $(this).removeClass("desc-show"); }, function () { $(this).addClass("desc"); } ); </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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