Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As previously reported, there is a closing parenthesis missing at the end of the first handler.</p> <p>Inside your handlers, you should use <code>$(this)</code> which references to the element that fired the event rather than <em>all divs of the document</em>:</p> <pre><code>$(document.ready(function(){ $('div').mouseover(function(){ $(this).slideDown('slow'); }); $('div').mouseout(function(){ $(this).slideUp('slow'); }); }); </code></pre> <p>I also recommend that you handle a more specific selector than <code>div</code>... with such a confusing selector you reduce your page to a "cannot change anything"-state. With a markup like this:</p> <pre><code>&lt;div class="hover-effect"&gt; &lt;!-- content --&gt; &lt;/div&gt; </code></pre> <p>You could have something like this:</p> <pre><code>$('.hover-effect').mouseover(/* ... */); $('.hover-effect').mouseout(/* ... */); </code></pre> <hr> <p><strong>UPDATE:</strong></p> <p>According to the jsfiddle you provided, you are basically trying to handle the mouseover event on a div that isn't displayed. Your code works exactly as expected. If you play baseball, you will surely have an epic time trying to hit the ball while it hasn't been thrown yet.</p> <p>First, you need a container that will always have some width and height. One way to ensure this can be to set a top padding to the container. Inside that container, your slider can slide as you wish without reaching the "nothing"-state. For the benefits of a free pointer effect, I assumed that it is intended to be displayed as a link.</p> <p>Try this:</p> <p><strong>HTML</strong></p> <pre><code>&lt;a class="slider-container" href="#"&gt; &lt;div class="slider"&gt;&lt;/div&gt; &lt;/a&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>.slider-container { display:block; width:100px; padding-top:25px; background-color:#000000; } .slider { width: 100px; height: 100px; background-color:#000000; display:none; } </code></pre> <p><strong>JQUERY</strong></p> <pre><code>$(document).ready(function(){ var $slider_container=$('.slider-container'); $slider_container.mouseover(function(){ $('.slider',this).stop().slideDown('slow'); }); $slider_container.mouseout(function(){ $('.slider',this).stop().slideUp("slow"); }); }); </code></pre> <p>Take a look at this working <a href="http://jsfiddle.net/4CdFP/11/" rel="nofollow">FIDDLE</a></p>
    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.
 

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