[jQuery] slideDown callback problem

[jQuery] slideDown callback problem

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=394323714-06092006>Been playing with
the accordion function over @ <A
href="http://fmarcia.info/jquery/accordion.html">http://fmarcia.info/jquery/accordion.html</A></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=394323714-06092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=394323714-06092006>Couldn't get it to
work with the latest jQuery build until I noticed something
weird:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=394323714-06092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=394323714-06092006>The script worked
when I change the running variable to "3":</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=394323714-06092006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=394323714-06092006>running =
3;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=394323714-06092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=394323714-06092006>Upon further
investigation, it appears the the slideDown call is firing the callback twice.
If you run the following code, you'll notice that the slideUp callback alerts
once and the slideDown callback alerts twice. Is this a bug or am I
misunderstanding something?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=394323714-06092006></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=394323714-06092006><FONT
face="Courier New"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"</FONT><A href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><FONT
face="Courier New">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</FONT></A><FONT
face="Courier New">"><BR><html><BR> <head><BR>  <title></title>  <BR>  <script
type="text/javascript"
src="jquery-1.01.js"></script><BR>  <script
language="JavaScript"
type="text/javascript">//<![CDATA[<BR>    <BR>   $.accordian
= function(l, b, a) {</FONT></SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=394323714-06092006>    var active =
a,<BR>     running =
0;<BR>    $(b).not(active).hide();<BR>    $(l).click(function(e){<BR>      <BR>      var
p = $('div', this.parentNode);<BR>      if
(running || !p.is(":hidden")) return
false;<BR>      <BR>      running
= 2;<BR>      $(active).slideUp('fast',
function(){--running;alert('sliding Up ' +
running);});<BR>      active = '#' +
p.slideDown('slow', function(){--running;alert('sliding Down ' +
running);}).get(0).id;<BR>      <BR>      return
false;<BR>     })<BR>   };<BR>   <BR>   $(document).ready(function(){<BR>    $.accordian('#main/div/a','#main/div/div','#diva');<BR>   });<BR>  //]]></script><BR> </head><BR> <body><BR>  <div
id="main"><BR>    <div
id="div1"><BR>   <a href="#">Title of First
Level</a><BR>   <div
id="diva"><BR>    
<div><BR>    consectetuer adipiscing
elit<br/><BR>    Sed lorem
leo<br/><BR>    lorem leo consectetuer adipiscing
elit<br/><BR>    Phasellus sem
leo<BR>    
</div><BR>   </div><BR>   
</div><BR>    <div
id="div2"><BR>   <a href="#">Title of Second
Level</a><BR>   <div
id="divb"><BR>    
<div><BR>    bibendum at,
eros<br/><BR>    Cras at mi et tortor egestas
vestibulum<br/><BR>    Phasellus sem
leo<BR>    
</div><BR>   </div><BR>   
</div><BR>    <div
id="div3"><BR>   <a href="#">Title of Third
Level</a><BR>   <div
id="divc"><BR>    
<div><BR>    Morbi eros
massa<br/><BR>    interdum et, vestibulum id, rutrum
nec<br/><BR>    bibendum at,
eros<br/><BR>    Cras at mi et tortor egestas
vestibulum<br/><BR>    Phasellus sem
leo<BR>    
</div><BR>   </div><BR>   
</div><BR>  </div><BR> </body><BR></html></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=394323714-06092006></SPAN></FONT> </DIV>
<DIV align=left> </DIV>
<DIV align=left><SPAN class=394323714-06092006><FONT face=Arial size=2>Thanks
for any help!</FONT></SPAN></DIV>
<DIV align=left>
<HR>
</DIV>
<DIV align=left><FONT face=Arial size=2>Neil</FONT></DIV></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/