Getting Spry Accordion Panels to Open on Mouseover

In the Dreamweaver Spry widgets, one of them is a collapsible accordion, giving panels of content hidden within the page.

By default, the panels are set to open on click, but like seen on the Apple site, this can be changed so the panels open when the tabs are moused over.

Getting this to work is quite straight-forward, you just need to open the SpryAccordion.js file and go straight to line 288. You will find this:

Change "click" to "mouseover"

Change "click" to "mouseover"

Change the eventListener to “mouseover” so your new line reads:

Spry.Widget.Accordion.addEventListener(tab, “mouseover“, function(e) { return self.onPanelTabClick(e, panel); }, false);

Save it and upload.

If you want to have your page load so all the panels are closed, go to the bottom of your main page code and add this before the closing </body> tag:

<script type=”text/javascript”>
var Accordion1 = new Spry.Widget.Accordion(“Accordion1”, { useFixedPanelHeights: false, defaultPanel: -1 });

other page


  1. Usenext

    Damn, that sound’s so easy if you think about it.

  2. emil07

    This function is great. However, this solution closes the tab on mouseout. I’d like to keep the panel tab open while I navigate through the content (which is created with ul with each li attached to different pages). Then I’d like to close the tab (with animation) when I click on another tab. Is there a way to achieve this?
    Many thanks,

  3. emil07

    Thanks for getting back so quickly. My code looks just like what you’ve indicated above, yet on mouseout the tab closes by itself (and I’m not even hovering over the next tab which is what your testimonials page does):

    var self = this;
    Spry.Widget.Accordion.addEventListener(tab, “mouseover”, function(e) { return self.onPanelTabClick(e, panel); }, false);
    Spry.Widget.Accordion.addEventListener(tab, “mouseover”, function(e) { return self.onPanelTabMouseOver(e, panel); }, false);
    Spry.Widget.Accordion.addEventListener(tab, “mouseout”, function(e) { return self.onPanelTabMouseOut(e, panel); }, false);

    I should point out that my accordion panel has only one tab that has content but the rest of the tabs don’t have any. Instead each of those tabs are linked to another html page. In other words, Tab 1 has contents with ul, and Tab 2, 3 & 4 have no contents but when clicked (directly on the tab) each direct you to a new page. In that instance the accordion panel animation is broken and appears like the Tab 1 is collapsing. Hope this makes sense… Is there a workaround this?

    Thanks in advance for your help!

    • Designermagic

      Can you send me a link to your page, or zip a copy and email it to info @ (no spaces) and I’ll have a look at it on Tuesday.

  4. DinahT

    I put in the code for the panel to be closed when loading page. It worked, however, when I mouse over the tab, panel doesn’t open.

    What am i doing wrong?

It's good to talk!

Your email address will not be published. Required fields are marked *