Wizzud - Just wanted to let you know I finally got around to implementing this - it works great!!
After picking it apart - I learned a lot - thanks for the example! Jim > -----Original Message----- > From: Wizzud [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 16, 2007 5:17 AM > To: [email protected] > Subject: [jQuery] Re: Help with show/hide script > > > > The problem you have is due to the slideDown. Because that takes time > (whereas the hide() is instantaneous), clicking "Hide TOC" > while the toc is > still sliding won't stop the actions that take place (within > jQuery) during > and at the end of the slide. > > One possible alternative (of many) is ... > > var sliding = false; > $('mybutton').click(function() { > if(!sliding){ > var _m = $('#manual'); > sliding = _m.is('.bodywide'); > if(sliding){ > $('#toc').slideDown("slow", function(){ > sliding = false; > // putting the text change in here means the user is not > presented > // with "Hide TOC" until the code is in a > position to actually > action the click > $('#mybutton').text("Hide TOC"); > }); > _m.removeClass("bodywide").addClass("bodytoc"); > }else{ > $('#toc').hide(); > _m.removeClass("bodytoc").addClass("bodywide"); > $('#mybutton').text("Show TOC"); > } > } > return false; > }); > > ... which prevents any action on the click if the slide is still in > progress. >

