• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2445
  • Last Modified:

How to change image within MS Ajax Accordion control header upon mouse click

customer has requested that plus-sign / minus-sign images be used in individual accordion panel headers to indicate that the panel can be expanded or contracted.
The current ASPX code reads:
<Header><a href="" onclick="return false;"><strong>1. <em>Enable</em></strong> Access For New User</a></Header>
Am I right that this has to happen?
1.  Insert image with ID tag within the header.
2. Change the onclick event code to perform a real JavaScript function which changes the image's URL property.
3. Return false from the JavaScript function so as not to kill the normal Accordion operations.

Can anyone point me toward or supply a sample as how to make it work?

Thank you.
Richard
0
RichardKline
Asked:
RichardKline
1 Solution
 
Airyck666Commented:
This might work...
Adding background image to the styles you defined for the accordion headers.

For instance, if you defined the following css classes in your accorion initialization:
    HeaderCssClass="definedAccordianHeader"
    HeaderSelectedCssClass="definedAccordianSelectedHeader"

then you could make the following additions to the styles for those two classes (see comments for more info):
.definedAccordianHeader {
    background-image: url('collapse.png'); /* Point to your minus img */
    background-repeat: no-repeat;
    background-position: 4px 7px;   /* Adjust this (x y) to fix spacing of image within the line */
    padding-left: 18px; /* Adjust this for the starting point for the text in the header */
}
 
.definedAccordianSelectedHeader {
    background-image: url('expand.png'); /* Point to your plus img */
    background-repeat: no-repeat;
    background-position: 4px 7px;   /* Adjust this (x y) to fix spacing of image within the line */
    padding-left: 18px; /* Adjust this for the starting point for the text in the header */
}

Open in new window

0
 
RichardKlineAuthor Commented:
This worked perfectly fine!
One minor correction.  Switch the Collapse/Expand images locations.   Expand belongs with default.  Collapsed belongs with the SelectedHeader.

This CSS solution is much preferred.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now