[jQuery] Wait for event to complete
<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">I'm just starting up with jQuery, and have run into a problem with my navigation menu.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>It's a vertical accordion menu, with each section opening when clicked, and any other open sections close. Also, a section will close if it's open and clicked.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>So, I have the following code attached to the <a> elements in the menu:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">$(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'.topMenu'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">click(</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">function</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">(){</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> $(</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">this</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">next()</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">addClass(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'active'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> $(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'ul.level1'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">filter(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">':visible'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">not(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'.active'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">slideUp(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'normal'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> $(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'.active'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">slideToggle(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'normal'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> $(</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">this</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">)</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">next()</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">.</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">removeClass(</SPAN></FONT><FONT class="Apple-style-span" color="#006600" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">'active'</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">);</SPAN></FONT><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> return</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">false</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">;</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">});</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">The HTML looks like this:</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><ul></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li></SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"link.htm"</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">class=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"topMenu"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Section 1</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></SPAN></FONT><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><ul</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">class=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"level1"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">link.htm</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Link 1</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">link.htm</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Link 2</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></ul></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li></SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"link.htm"</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">class=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"topMenu"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Section 2</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></SPAN></FONT><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><ul</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">class=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"level1"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">link.htm</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Link 1</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">link.htm</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Link 2</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></ul></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li></SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"link.htm"</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">class=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"topMenu"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Section 3</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></SPAN></FONT><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><ul</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">class=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"level1"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">link.htm</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Link 1</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><li><a</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">href=</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">link.htm</SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">></SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">Link 2</SPAN></FONT><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></a></li></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 128); font-family: Monaco; font-size: 11px; "> </SPAN><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></ul></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></li></SPAN></FONT></DIV><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></SPAN></FONT></DIV><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></SPAN></FONT></DIV><FONT class="Apple-style-span" color="#000080" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"></SPAN></FONT></DIV><P style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"></ul></P><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">This flags the clicked link; closes all the sections at the same level that are not the flagged link; toggles the clicked link; then removes the flag; and finally returns false so the browser doesn't follow the link.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">My problem is that, as the code stands, the closing and opening take place at the same time; I want the open sections to close, and then when that's finished the clicked section should toggle.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I initially thought the callback feature would handle this; but after trying to work out why it didn't work, found that the rest of the script continues.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I also thought chaining might be the answer, but couldn't get it to work as I wanted...</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">How can I get the slideToggle to wait for the slideUp to complete?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Seb</DIV></BODY></HTML>_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/