Collapse panels - close all button

I am trying to use the Collapsible Panels widget for a FAQ
page. Each Q/A is in its own CollapsablePanel group, so there are
about 30 of them. I just created unique IDs for each -
ID="CollapsiblePanel1", ID="CollapsiblePanel2", etc.
Any idea how to create buttons to open/close all the panels
at once? I am not that good with Javascript, so any input would be
great and helpful.
Thanks

Hi MiloZ69,
30 panels? Yikes!!! One of the widgets I have on my plate is
a CollapsiblePanelGroup, which is basically the same markup as an
accordion but it allows you to open/close *any* panel. Sounds like
you could sure use that widget right now since it only requires a
single constructor call and object to control all panels.
Until then, you'll have to manage this manually. Make sure
all your collapsible panels have a predictable id like "cp1",
"cp2", etc., then try using this:
<script language="JavaScript" type="text/javascript">
function PanelGroup(idPrefixStr, startIndex, lastIndex,
options)
this.idPrefixStr = idPrefixStr;
this.startIndex = startIndex;
this.lastIndex = lastIndex;
for (i = this.startIndex; i <= this.lastIndex; i++)
var id = this.idPrefixStr + i;
var ele = $(id);
// Call the CP constructor and store the object
// on the element itself so we can retrieve it later.
if (ele)
ele.spryCP = new Spry.Widget.CollapsiblePanel(id, options);
PanelGroup.prototype.getWidget = function(panelIndex)
var widget = null;
var ele = $(this.idPrefixStr + panelIndex);
if (ele)
widget = ele.spryCP;
return widget;
PanelGroup.prototype.openPanel = function(panelIndex)
var w = this.getWidget(panelIndex);
if (w)
w.open();
PanelGroup.prototype.closePanel = function(panelIndex)
var w = this.getWidget(panelIndex);
if (w)
w.close();
PanelGroup.prototype.openAllPanels = function()
for (var i = this.startIndex; i < this.lastIndex; i++)
this.openPanel(i);
PanelGroup.prototype.closeAllPanels = function()
for (var i = this.startIndex; i < this.lastIndex; i++)
this.closePanel(i);
</script>
Instead of calling a constructor for each collapsible panel,
you can then use the PanelGroup constructor which will
automatically call the constructor for each one:
<script language="JavaScript" type="text/javascript">
var cpg = new PanelGroup("cp", 1, 30, { contentIsOpen: false
</script>
Then add your buttons to trigger the appropriate function:
<input type="button" value="Open"
onclick="cpg.openPanel(3);" />
<input type="button" value="Close"
onclick="cpg.closePanel(3);" />
<input type="button" value="Open All"
onclick="cpg.openAllPanels();" />
<input type="button" value="Close All"
onclick="cpg.closeAllPanels();" />
--== Kin ==--

Similar Messages

  • Collapsable Panel Group: Button Toggle

    Hello,
    I have a Collapsable Panel Group with the buttons 'open all' and 'close all'
    Is there a way to make this into one button which toggles?  So, if they're open, then close, and vice versa.
       <input type="button" value="Open All" onclick="cpg.openAllPanels();" />
       <input type="button" value="Close All" onclick="cpg.closeAllPanels();" />
    Thanks for any info.
    Andy

    Thanks for that, works just fine.
    I put it into the SpryCollapsiblePanel.js file with this explanation.
    // extra code to make the [open all], [close all] buttons into one toggle button. Thanks to http://forums.adobe.com/people/.V1
    // works with this button in the main code ..  <input type="button" value="Toggle" onclick="toggle();" />

  • How can I use the tabbed panel with the accordion panel options of close all panels and over/not overlap the items below?

    Ideas for features in Adobe Muse

    I assume this is what you want to achieve in the footer....
    Make sure in Muse before you export that the panel is closed, and also as Brad suggested, make sure Overlap Items Below is unchecked. I would also check the "Can Close All" button.

  • Close all apps button missing Xperia Z3

    After I updated to Lollipop, the "close all" button in recent apps has disappeared.Strange to take away features in a "update", isn't it?

    I found some issues in Xperia Z3 5.0.2 update and want to share with Sony Xperia Z3 software DevelopersPlease send it to Xperia Z3 software developers. 
    1- Device Freeze sometime when we open a game.
    First issue that I am facing is that some time when we start a game device freeze and nothing happened i have to force restart the device to fix it
    I face it on different games and believe me games are fully compatible with Lollipop, working fine on my Brother Note 4 lollipop.
    Sony may need to fix the GPU drivers libs files in system. I am talking about this issue after examining every thing and it is surly related with software. 2- No Close all button in recent panel.
    In Kitkat we have a close all button in recent app panel to close all apps at once, but no button in Lollipop. 3- No Camera Raw Capture in Stock & support for third party apps.
    Lollipop it self have a feature to capture pictures in Raw format, but it seems Sony remove this feature from their update and also block it for third party camera apps and they are not able to get the permission from mobile to capture in Raw.
    Please Sony If you don't want to give this feature in your stock camera app its fine for me, but at-least put this feature back in lollipop so that we can take picture in Raw with third party camera apps 4- No Stereo Ringtone Sound.
    When some one call us then ringtone start ringing, and ring sound only come from bottom speaker more louder then very very low from top speaker.
    You need to modify the sound files in system/etc/tfa98xx folder to fix this issue. 5- Device Getting slow charging
    In Kitkat my z3 charged faster then the lollipop.
    I can conform that i am using Sony Z3 Original charger for charge my device, and their is no issue in charger.
    I am talking about this issue after examining every thing that it is surly related with software. 6- Device heating up more in 5.0.2 as compare to 4.4.4 while heavy usage
    This will fix also when Sony Fix GPU drivers libs files in system as describe up, in note # (1) 7- Battery Drain is faster then the kitkat
    I do not want to explain it more, because as I describe up their is an issue regarding Device heating up because of system files and obviously Battery drain is also faster then normal. 8- About Volume and Notifications
    8.1- Some time my media sound automatically decrease from settings/sound & notification / Media Volume.
    8.2- When silent mode off and interruptions are allowed for Notification even then some time my phone remain silent at the time of arrival of notifications.  Please send it to Xperia Z3 software developers

  • Is it possible to add an Expand all/Collapse all button in WebHelp Output?

    Hi there,
    We now have > 15 child projects in our merged online help, each containing hundreds of topics. Each child project is a chapter in our WebHelp online help output.
    If a user opens a couple of topics in each project, the TOC can become difficult to navigate. Is it possible to add a button that enables users to collapse all of the open chapters / expand all of the closed chapters? We are using RoboHelp 10.
    Thanks a lot,
    Niamh

    Hi there
    Expanding all could be problematic. But collapsing all should be a snap. That is, as long as you don't mind one teensy side effect. That side effect would be that the default topic would load up in the Topic pane and replace whatever topic was open at the time your user clicked the Collapse All.
    The way to Collapse All is to simply create a hyperlink that re-opens the WebHelp start page. Things reload fresh (with the TOC all nice and collapsed).
    If you would like to suggest to the Adobe development team that we actually get proper collapse or expand all buttons, please feel free to suggest it using the link below:
    http://www.adobe.com/go/wish
    Cheers... Rick

  • DW CS6 - Spry collapsible panels - How to have panel close when you click away from it?

    I know typically onmouseout is used to close other items, but I could not figure it out with the spry collapsible panel. I have the panel opening onclick and closing onclick, but I would really like for it to close when you click anything else on the page outside of the panel.
    Thank you!

    Sorry, I did not mean other collapsing panels close when you click away from it. I simply meant in general for the closing after clicking away function, you can use onmouseout. I was working on something with collapsing panels and I wanted it to show the information when you clicked on it, but when you click on another panel, they both remain open. I really want both to close. I believe accordion does this, but not quite what I am looking for either.
    Here is a better example of what I would prefer: Houston Public Library
    If you visit their page and click "Find it" a box pops down with information and then when you click anywhere else on the screen, it closes that box. When you click "Research," it closes the "Find It" box and opens the "Research" box. There is likely a much better way to do this, but I am pretty new to this.
    Any assistance is very much appreciated.
    Thank you!

  • Multiple HideShow Regions - Open/Close All

    Using Oracle 10g, Apex 3.1.0
    I have a page with multiple hideshow regions.
    The customer would like to be able to open or close all of them with one or two ('OPEN ALL','CLOSE ALL') buttons but still have the standard open & close ability (one at a time).
    Possible?
    Bob

    check this out
    http://apex.oracle.com/pls/otn/f?p=35250:6:3551482161152928::NO
    I hope it helps!
    Sam
    Please reward good answers by marking them correct or helpful!

  • Programmatically Open and close panel accordion on button click

    Hi All,
    Im using JDev 11.1.1.4 and adf faces application.
    My requirement is to open/close panel accordion on button click programmatically.Kindly have a look at below figured one
    Panel accordion Open Button
    | ShowDetail1 //Consider first one is open inside close button is there to close this pane..
    |
    |
    |
    Close Button
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Show detail2 open button
    Show details3 open button
    Any idea...
    Thanks,

    Thanks Mr.frank...
    But disclosed property is to make the showdetail to disclose or not.. but requirement is to open panel accordion on button click
    By default using panel accordion have arrow icon in left to open in a same way if i open the second one, first will get close automatically...
    Actually is there any way to do the default process (open/close) programmatically...

  • Globally open and close all accordion panels

    Is there a way to globally open and close all accordion
    panels? For example, it would be nice to have an "Expand all" and
    "Collapse all" link at the top of the page, before the accordion,
    that has this functionality.

    Hi FM_n_DC,
    Accordions can only ever have a single panel open. If you
    want individual control over which panels are open you probably
    want to use a CollapsiblePanelGroup. This sample shows how to open
    all and close all of the panels of the CollapsiblePanelGroup:
    http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/CollapsiblePanelGroupSamp le.html
    --== Kin ==--

  • Script to Close all the collapsible panels on click of one collapsible panel

    Hi All,
    Please help me with modifying the script or a new script to suffice the following.
    I have around 5 to 6 collapsible panels in many html files. There is a huge content under each panel and thats the reason I want to collapse i.e., close all the open panels and open the panel that is clicked on.
    that is initially i click on panel 1 - > Panel 1 opens and contents are displayed.
    now I click on panel 2 - > panel 1 should close and panel 2 should open.
    Please help me acheive this.
    Thanks in advance.

    To close the remaining panels you can just use the onclick method and however many panels you have just add them to the list spacing them out with a " , "
    Here is an example of 3 panels that close and open, upon clicking on one of the panels.
    <div id="CollapsiblePanel1" class="CollapsiblePanel">
      <div class="CollapsiblePanelTab" tabindex="0" onclick="CollapsiblePanel2.close(),CollapsiblePanel3.close()">Tab 1</div>
      <div class="CollapsiblePanelContent">Long-Sleeve Prices</div></div>
    <div id="CollapsiblePanel2" class="CollapsiblePanel">
      <div class="CollapsiblePanelTab" tabindex="0" onclick="CollapsiblePanel1.close(),CollapsiblePanel3.close()">Tab 2</div>
      <div class="CollapsiblePanelContent">T-Shirt Prices</div>
    </div>
    <div id="CollapsiblePanel3" class="CollapsiblePanel">
      <div class="CollapsiblePanelTab" tabindex="0" onclick="CollapsiblePanel1.close(),CollapsiblePanel2.close()">Tab 3</div>
      <div class="CollapsiblePanelContent">Hat Prices</div>
    </div>

  • Collapsable Panel Group: close previous panel on next panel focus

    Hello All,
    I am playing around with Spry and started off with the Accordian.  But I wanted to be able to 'expand all' so moved on to the collapsable panel.
    However, I also want the accordian effect, whereby when one panel is clicked and opened, the previous panel will close.  Is there a variable to include in the collapsablepanelgroup to acheive this?
    Looking at it another way, I want to 'close open panel(s), open new panel', when the mouse clicks on the new panel.
    I'm using Spry Pre-Release 1.6.1
    You can see my efforts so far at http://yabbox.com/spry.php
    Many thanks for your help and direction.
    Andy

    My first answer would be.. Use the accordion ;D
    However, I also want the accordian effect, whereby when one panel is clicked and opened, the previous panel will close.  Is there a variable to include in the collapsablepanelgroup to acheive this?
    Not with out modifications to the collapsible panel code.
    But you could just create a custom for you that remembers the previouse panel that was clicked...
    and add onclick="" to each panel tab to activate the function

  • Panels Accordion - want to close all panels when navigate away

    Hi complete Newbie, so apologies if answered already or a no brainer. Using panel accordion and love the effect. However, have placed a link to another page within one of the sections. Works fine except when new page loaded, panel section is still in 'open' state. Is it possible to get accordion to collapse when mouse rolls out of panel or a link within it is clicked?
    Thanks in anticipation.
    Joe

    Hi Joe,
    I believe you have placed the accordion panel on the master page, on the master page please select options for the accordion panel and select can close all: http://prntscr.com/3ofqgx
    Once you have added the link to the section in accordion panel, please make sure all the sections are closed.
    Doing this will load the target page but as the master page has the accordion closed, it will be rendered on the page as closed.
    Regards,
    Gaurav Aggarwal

  • One link to open/close all _accordion_ panels

    I am aware that collapsible panels have group feature and you can open and close all panels by wrapping the individual panels within a group.
    Is there a way to open all panels in an accordion widget?

    Open all, no.
    Close all, yes (set panel to -1, with the useFixedHeights:false option)

  • How can I close all open subVI front panels, without closing my top level VI front panel when all VIs are built into executables?

    I'm using the code shown in the sample VI discussed here: http://digital.ni.com/public.nsf/allkb/353A696A3F393D9B86256E8B007A2912
    to close all open VIs except my top level VI.  My top level VI is actually a separate executable and the sub-VIs are their own executables.  All reside under the same project.  It works very well if I'm running in LabView but will not work when I build them.  I added all the sub-VIs to the Always Include box in my top level VIs properties which did nothing.  I also tried adding them to the Startup VIs box.  This allowed me to close them all programmatically from the top level VI but it also open all the VIs at once (which was expected and not desired).  I think the problem is the executables are not able to see outside their own memory space so the top-level VI never finds any other open front panels to close.  Is this correct?  Is there another way to go about doing this? 
    Thanks!

    Where do I begin…..
    I’m using a “server” to control 4 “client” PCs.  My server opens references to 4 VIs on each client then executes them sequentially.  So on a normal day, the server will run everything itself and I will have no contact with the clients.  But on a several occasions, I’ve needed the ability to walk up to one of the clients and run just one of the 4 VIs. 
    We are updating from LabView 6.1 to 8.5 and we want to run executables rather than VIs for various reasons.  I have a new VI running on the client PCs who’s only function is to initialize the shared variables and open/close the VIs.  I initially thought of making the remaining 4 VIs sub-VIs but I will loose the ability to run them individually.  I think I would also have to rewrite the VI running on the server since the 4 references it originally opened do not exist.  I don’t think you can open a reference to a sub-VI on another PC.  Can you???
     As you can see, this is a huge mess.  I’m still pretty new with LabView so any help you can provide would be great. 

  • Model diloge button click open another diloge and close of another diloge close all model diloges.

    When user clickes on link he gets model diloge with some fields,
    when clicked OK button all values will save and user should get another diloge, and on another diloge save form will close, and that should close all diloges.
    Or we can have like on click on OK button close save values current diloge and open another one. and Another one when clicked submite close it.
    how this can be achive.
    i tried
    string pageUrl = "/siteName/_layouts/Solutionname/form.aspx?isdlg=1&ID=" + newRequestID;
    string script = @"<script type='text/javascript'>window.frameElement.commitPopup();
    var modalDialog;
    function ShowForwardDialog() {
    var options = {
    url: '" + pageUrl + @"',
    tite: 'Time Title...',
    allowMaximize: false,
    showClose: true,
    width: 440,
    height: 120 };
    modalDialog = SP.UI.ModalDialog.showModalDialog(options);
    ExecuteOrDelayUntilScriptLoaded(ShowForwardDialog, 'sp.js');</script>";
    ClientScript.RegisterClientScriptBlock(this.GetType(), "OKScript", script);
    also tried without window.frameElement.commitPopup(); but nothing seem working.

    I used 1600Mhz Corsair Vengeance RAM. You can either get it in matched sets or in single modules.
    The default system RAM is made by Samsung and also runs at 1600Mhz.
    Thinkpad W530, i7-3720QM, 1920x1080 screen, 32GB RAM, dual SSDs (Samsung 830, Crucial M4 mSATA), Quadro K2000M, 9-cell battery, DVD burner, backlit keyboard, Bluetooth, Intel 6300 wireless card

Maybe you are looking for