title: Undesired "flashing" in Jquery dropdown menu?
body: <p>I've got the following piece of Jquery:</p>
  
  <pre><code>$("#collapse-menu &gt; li &gt; a").click(function() {
      $(this).toggleClass("expanded").toggleClass("collapsed").find("+ ul").slideToggle("medium");
  });
  </code></pre>
  
  <p>What it basically does is expands or collapses a menu of nested "lists" which contain dropdowns (simplified example):</p>
  
  <pre><code>&lt;ul id="collapse-menu"&gt;
     &lt;li&gt;&lt;a class="expanded"&gt;Basic Details&lt;/a&gt;
        &lt;ul&gt;
           &lt;li&gt;
              &lt;select&gt; .... &lt;/select&gt;
           &lt;/li&gt;
           &lt;li&gt;
              &lt;select&gt; .... &lt;/select&gt;
           &lt;/li&gt;
  </code></pre>
  
  <p>The code works absolutely fine EXCEPT when a large value is selected in any of the dropdowns. At that point, when clicked, the menu will still expand/collapse correctly but "flash" quickly while doing so, as if the entire element was being reset somehow. The data itself is fine but it's the flashing that's unwanted.</p>
  
  <p>The strange thing is that if a small value is selected in a dropdown, there's no flashing. When a large value is selected (say, above 30 in an age dropdown of 18-99), the flashing starts happening.</p>
  
  <p>Can anyone tell me why this is happening? Or whether there's something not right about the Jquery that's causing this.</p>
  
  <p>Thanks.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Adding a bounty to this. Have tried a few similar plugins/solutions out there on the net but they all seem to suffer from this "flashing" problem when large dropdown values are selected by default.</p>
  
  <p>If it helps, here's a typical similar solution: <a href="http://www.i-marco.nl/weblog/jquery-accordion-menu/index_collapsed.html#" rel="nofollow noreferrer">http://www.i-marco.nl/weblog/jquery-accordion-menu/index_collapsed.html#</a>  ... but it suffers from the same problem when dropdowns are added inside the accordion.</p>
  
  <p>I hope someone has a clean solution, instead of needing to hack this somehow.</p>