I'm skipping around the jQuery book (finally!) and working on converting an existing PDF manual into an HTML doc - I created the following script to show/hide a table of contents - and widen the page content using a toggle:
<script> $(document).ready(function() { $('#mybutton').toggle( function() { $('#toc').slideDown("slow"); $("#manual").removeClass("bodywide").addClass("bodytoc"); $('#mybutton').empty().prepend("Hide TOC"); }, function() { $('#toc').hide(); $("#manual").removeClass("bodytoc").addClass("bodywide"); $('#mybutton').empty().prepend("Show TOC"); }); $('#mybutton').trigger("click"); $('.thickbox').after('<p class="imgtext">(click image to enlarge)</p>'); }); </script> It works - but if I rapidly click on the 'Show/Hide TOC' element - sometimes the TOC will still be visible... Looking in the book I see a similar example with the headline rotator. They set a variable and then check that when the function executes (on hover) to see if it's already been thrown. But I'm stuck in implementing something like that with the toggle... Any ideas or suggestions? Thanks!! Jim