jQuery
New Wave Javascript


discuss » Toggle


Posted: Tue Feb 14 15:57:50 EST 2006
From: John Resig <jeresig at gmail.com >

You should probably have one link for each section (I imagine) - so
you have some more code blocks like this:

$("#jQJSLink").toggle(function(){
$(this).html("&nbsp;+/-");
$("#jQJSNews").slideUp("slow");
},function(){
$(this).html("&nbsp;-/+");
$("#jQJSNews").slideDown("slow");
});

$("#jQFAQLink").toggle(function(){
$(this).html("&nbsp;+/-");
$("#jQFAQ").slideUp("slow");
},function(){
$(this).html("&nbsp;-/+");
$("#jQFAQ").slideDown("slow");
});

Of course, all of this is without any optimization of the code - which
could probably be done if you were looking to do multiple effects,
like this.

--John

On 2/14/06, Daniel Acuff <jojowebdev at gmail.com> wrote:
> Multiple Toggle Sections.
>
> I wanted to take my toggle world to the next level and create a couple
> sections.
>
> My instinct tells me I can create a couple more sets in the script to make
> it happen.
>
> <script type="text/javascript">
> $(document).ready(function(){
> $("#jQLink").toggle(function(){
> $(this).html("&nbsp;+/-");
> $("#jQNews").slideUp("slow");
> },function(){
> $(this).html("&nbsp;-/+");
> $("#jQNews").slideDown("slow");
> });
>
> /* $("#jQJSNews").slideUp("slow");
> $("#jQJSNews").slideUp("slow");
> */
> /* $("#jQFAQ").slideUp("slow");
> $("#jQFAQ").slideUp("slow");
> */
>
> });
> </script>
>
> But Would there also have to be a new variable name for jQLink ?
>
> Thanks. p.s. refering to my page.
> http://www.jojowebdesign.com/skills/javascript/javascript_content.asp
>
>
>
> --
> Dan Acuff
> Sr. Web Designer, Sr. Web Developer
> www.jojowebdesign.com
> 203.733.6336
> jojowebdev at gmail.com
> _______________________________________________
> jQuery mailing list
> discuss at jquery.com
> http://jquery.com/discuss/
>
>
>


--
John Resig
http://ejohn.org/
jeresig at gmail.com