simple accordion script help

67 views
Skip to first unread message

Cluster

unread,
Jan 23, 2012, 8:53:19 AM1/23/12
to Prototype & script.aculo.us
hi
i am using simple accordion script(http://www.p51labs.com/
accordion/) , it works fine. now i want to place a continue button in
content of each each tab, if this button is clicked then it should
open next tab and current tab should collapse. can anyone help me
please. i am using the below code

<div id="step1" class="accordion-toggle">Step1</div>
<div class="accordion-content">
bla bla bla
<!--i want to place a continue button here <input type="button"
value="Continue">-->
</div>

thank you

Walter Lee Davis

unread,
Jan 23, 2012, 11:44:37 AM1/23/12
to prototype-s...@googlegroups.com
I haven't used that particular script before, so this may be overkill. Does this script only allow one segment to remain open at a time? (When you click on a closed segment, does any currently-open segment close as the clicked segment opens?) If so, you could probably simplify this a lot. But assuming you would have to click on the current segment's header to close it, try this:

$$('div.accordion-content button').invoke('observe','click', function(evt){
if(this.up('div').next('.accordion-content')){
this.up('div').hide().next('div.accordion-content').show();
}
});

That script should either appear after the accordion element, or it should be wrapped inside a dom:loaded listener.

Walter

> --
> You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
>

Reply all
Reply to author
Forward
0 new messages