Skip navigation
Currently Being Moderated

How to apply different styles to multiple spry accordian panels?

Jul 20, 2012 10:53 AM

Tags: #background #adobe #cs5.5 #dreamweaver #images #spry #code #dw

Hi all,

 

I have a website that I'm building that has multiple spry accordian features on it.

I am trying to apply different styles to each accordian. A problem arises when I try to place an accordian within another accordian.

 

I have styled two different background images for two of the accordians for the styles (AccordionPanelTab, AccordionPanelTabHover and AccordionPanelOpen AccordionPanelTabHover) which work fine.

 

When I try and place an accordian within another accordian the background image for this accordian for the styles (AccordionPanelTab and AccordionPanelOpen AccordionPanelTabHover) has the different style applyed that I stated in the accordion.css file, however the style (AccordionPanelTabHover) has the same style as the accordian it is within even though in the accordion.css file I stated a different background image.

 

I hope all this makes sence below is my source and CSS Code.

 

I appriciate any help that can be given to help resolve this issue I am running in too.

 

 

Source Code

 

<div id="content">

<p><span class="first_header_word_packages">Welcome</span> <span class="header_word_packages">to our packages page</span></p>

<p class="content_txt">Here you can build the website package that matches your business needs as well as being able to work out the cost of your site without having to worry about scary hidden costs at a later date.</p>

<p class="content_txt"> We have two packages available for our customers;</p>

 

 

<div id="Accordion1" class="Accordion" tabindex="0">

  <div class="AccordionPanel">

    <div class="AccordionPanelTab"></div>

    <div class="AccordionPanelContent">

   

   <p>Text Goes Here</p>

   

    <div id="Accordion2" class="Accordion" tabindex="0">

      <div class="AccordionPanel">

    <div class="AccordionPanelTab"></div>

    <div class="AccordionPanelContent">

    <p>Text Goes Here</p>

    </div><!-- end #Accordion2 Content -->

  </div><!-- end #AccordionPanel -->

</div><!-- end #Accordion2 -->

   

   

    </div><!-- end #Accordion1 Content -->

  </div><!-- end #AccordionPanel -->

</div><!-- end #Accordion1 -->

 

 

 

 

 

 

<div id="Accordion3" class="Accordion" tabindex="0">

  <div class="AccordionPanel">

    <div class="AccordionPanelTab"></div>

    <div class="AccordionPanelContent">

 

         <p>Text Goes Here</p>

       

   

      <div id="Accordion4" class="Accordion" tabindex="0">

        <div class="AccordionPanel">

    <div class="AccordionPanelTab"></div>

    <div class="AccordionPanelContent">

     <p>Text Goes Here</p>

    </div><!-- end #Accordion4 Content -->

  </div><!-- end #AccordionPanel -->

</div><!-- end #Accordion4 -->

     

    </div><!-- end #Accordion3 Content -->

  </div><!-- end #AccordionPanel -->

</div><!-- end #Accordion3 -->

 

 

</div><!-- end #content -->

 

 

CSS

 

@charset "UTF-8";

 

 

/* SpryAccordion.css - version 0.5 - Spry Pre-Release 1.6.1 */

 

 

/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */

 

 

/* This is the selector for the main Accordion container. For our default style,

* we draw borders on the left, right, and bottom. The top border of the Accordion

* will be rendered by the first AccordionPanelTab which never moves.

*

* If you want to constrain the width of the Accordion widget, set a width on

* the Accordion container. By default, our accordion expands horizontally to fill

* up available space.

*

* The name of the class ("Accordion") used in this selector is not necessary

* to make the widget function. You can use any class name you want to style the

* Accordion container.

*/

.Accordion {

          border-left: solid 1px gray;

          border-right: solid 1px black;

          border-bottom: solid 1px gray;

          overflow: hidden;

}

 

 

/* This is the selector for the AccordionPanel container which houses the

* panel tab and a panel content area. It doesn't render visually, but we

* make sure that it has zero margin and padding.

*

* The name of the class ("AccordionPanel") used in this selector is not necessary

* to make the widget function. You can use any class name you want to style an

* accordion panel container.

*/

.AccordionPanel {

          margin: 0px;

          padding: 0px;

}

 

 

/* This is the selector for the AccordionPanelTab. This container houses

* the title for the panel. This is also the container that the user clicks

* on to open a specific panel.

*

* The name of the class ("AccordionPanelTab") used in this selector is not necessary

* to make the widget function. You can use any class name you want to style an

* accordion panel tab container.

*

* NOTE:

* This rule uses -moz-user-select and -khtml-user-select properties to prevent the

* user from selecting the text in the AccordionPanelTab. These are proprietary browser

* properties that only work in Mozilla based browsers (like FireFox) and KHTML based

* browsers (like Safari), so they will not pass W3C validation. If you want your documents to

* validate, and don't care if the user can select the text within an AccordionPanelTab,

* you can safely remove those properties without affecting the functionality of the widget.

*/

.AccordionPanelTab {

          background-color: #CCCCCC;

          border-top: solid 1px black;

          border-bottom: solid 1px gray;

          margin: 0px;

          padding: 2px;

          cursor: pointer;

          -moz-user-select: none;

          -khtml-user-select: none;

}

 

 

/* This is the selector for a Panel's Content area. It's important to note that

* you should never put any padding on the panel's content area if you plan to

* use the Accordions panel animations. Placing a non-zero padding on the content

* area can cause the accordion to abruptly grow in height while the panels animate.

*

* Anyone who styles an Accordion *MUST* specify a height on the Accordion Panel

* Content container.

*

* The name of the class ("AccordionPanelContent") used in this selector is not necessary

* to make the widget function. You can use any class name you want to style an

* accordion panel content container.

*/

.AccordionPanelContent {

          overflow: auto;

          margin: 0px;

          padding: 0px;

 

}

 

 

/* This is an example of how to change the appearance of the panel tab that is

* currently open. The class "AccordionPanelOpen" is programatically added and removed

* from panels as the user clicks on the tabs within the Accordion.

*/

.AccordionPanelOpen .AccordionPanelTab {

          background-color: #EEEEEE;

}

 

 

/* This is an example of how to change the appearance of the panel tab as the

* mouse hovers over it. The class "AccordionPanelTabHover" is programatically added

* and removed from panel tab containers as the mouse enters and exits the tab container.

*/

.AccordionPanelTabHover {

          color: #555555;

}

.AccordionPanelOpen .AccordionPanelTabHover {

          color: #555555;

}

 

 

/* This is an example of how to change the appearance of all the panel tabs when the

* Accordion has focus. The "AccordionFocused" class is programatically added and removed

* whenever the Accordion gains or loses keyboard focus.

*/

.AccordionFocused .AccordionPanelTab {

          background-color: #3399FF;

}

 

 

/* This is an example of how to change the appearance of the panel tab that is

* currently open when the Accordion has focus.

*/

.AccordionFocused .AccordionPanelOpen .AccordionPanelTab {

          background-color: #33CCFF;

}

/* Rules for Printing */

 

 

@media print {

 

 

  .Accordion {

  overflow: visible !important;

  }

 

  .AccordionPanelContent {

  display: block !important;

  overflow: visible !important;

  height: auto !important;

  }

}

 

 

 

 

#Accordion1  .AccordionPanelTab {

height:75px;

width:285px;

background:url(../images/package_spry_tab_bg1.png);}

 

 

#Accordion1 .AccordionPanelTabHover,

#Accordion1 .AccordionPanelOpen .AccordionPanelTabHover {

background:url(../images/package_spry_tab_bg1_RO.png);}

 

 

 

 

 

 

#Accordion2  .AccordionPanelTab {

height:44px;

width:469px;

background:url(../images/packages_spry1.png);}

 

 

#Accordion2 .AccordionPanelTabHover,

#Accordion2 .AccordionPanelOpen .AccordionPanelTabHover {

background:url(../images/packages_spry1_ro.png);}

 

 

 

 

 

 

#Accordion3  .AccordionPanelTab {

height:75px;

width:285px;

background:url(../images/package_spry_tab_bg2.png);}

 

 

#Accordion3 .AccordionPanelTabHover,

#Accordion3 .AccordionPanelOpen .AccordionPanelTabHover {

background:url(../images/package_spry_tab_bg2_RO.png);}

 

 

 

 

 

 

#Accordion4  .AccordionPanelTab {

height:44px;

width:469px;

background:url(../images/packages_spry2.png);}

 

 

#Accordion4 .AccordionPanelTabHover,

#Accordion4 .AccordionPanelOpen .AccordionPanelTabHover {

background:url(../images/packages_spry2_ro.png);}


 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points