Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://api.jquery.com/hover/" rel="nofollow"><strong>.hover()</strong></a> takes two handlers, the first one is executed when your mouse enters, the second is executed when your mouse leaves. For this reason, simply swapping <a href="http://api.jquery.com/hover/" rel="nofollow"><strong>.hover()</strong></a> with <a href="http://api.jquery.com/click/" rel="nofollow"><strong>.click()</strong></a> will not work, since <a href="http://api.jquery.com/click/" rel="nofollow"><strong>.click()</strong></a> only takes one handler that executes when you click. However, <a href="http://api.jquery.com/toggle-event/" rel="nofollow"><strong>.toggle()</strong></a> can be used to bind multiple handlers to be executed on alternate clicks.</p> <pre><code>$(".navigation ul ul, .shoppingbasket ul ul").css({display: "none"}); $(".navigation ul li, .shoppingbasket ul li").toggle(function(){ $(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(400); },function(){ $(this).find('ul:first').css({visibility: "hidden"}); }); </code></pre> <p><a href="http://jsfiddle.net/pajtai/6WFEz/" rel="nofollow"><strong>Try it out here.</strong></a></p> <p>Also, it's hard to tell w/o the HTML, but <a href="http://api.jquery.com/slideDown/" rel="nofollow"><strong>.slideDown()</strong></a> will make the element visible, and you may want to use <a href="http://api.jquery.com/slideUp/" rel="nofollow"><strong>.slideUp()</strong></a>. So you might want to try something like this:</p> <pre><code>$(".navigation ul ul, .shoppingbasket ul ul").css({display: "none"}); $(".navigation ul li, .shoppingbasket ul li").toggle(function(){ $(this).find('ul:first').slideDown(400); },function(){ $(this).find('ul:first').slideUp(400); }); </code></pre> <p><a href="http://jsfiddle.net/pajtai/PPKvt/" rel="nofollow"><strong>Try it out here.</strong></a></p> <p>In fact, why not use <a href="http://api.jquery.com/slideToggle/" rel="nofollow"><strong>.slideToggle()</strong></a>, which makes things more compact and allows you to use <a href="http://api.jquery.com/click/" rel="nofollow"><strong>.click()</strong></a>?</p> <pre><code>$(".navigation ul ul, .shoppingbasket ul ul").css({display: "none"}); $(".navigation ul li, .shoppingbasket ul li").click(function(){ $(this).find('ul:first').slideToggle(400); }); </code></pre> <p><a href="http://jsfiddle.net/pajtai/ssEb5/" rel="nofollow"><strong>Try it out here.</strong></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.
    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