Results 1 to 3 of 3

Thread: Changing Switch Content Headers

  1. #1
    Join Date
    Nov 2006
    Location
    Washington State
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Changing Switch Content Headers

    1) Script Title: Switch Content I

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tchcontent.htm

    3) Describe problem:

    I was just wondering if there was a way to change the styling on the switch content script. I'm using CSS to add some style to the clickable headers, and by doing so I have added a :hover background image to them. My question is, is it possible to keep the background image on the header when it's DIV is expanded? I know in the script you can change the color, so I was wondering if there was a line of code I could add to the file that would give it a background image as well.

    Thanks!

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Certainly. I've modified the original switchcontent.js file with the ability to specify a CSS background for either/both the Closed or Open state of the header. Download the attached .js file and replace the original with it. With that done, the old method setColor now accepts 2 more parameters, to be optionally used to specify the CSS background when the header is open and closed, respectively. So you can now do all of the following:

    Code:
    myexample.setColor('green', 'red')
    myexample.setColor('green', 'red', 'url(open.gif)') //Open headers carry a background
    myexample.setColor('green', 'red', '', 'url(closed.gif)') //Closed headers carry a background
    myexample.setColor('green', 'red', '', 'url(open.gif)', 'url(closed.gif)') //Both open/closed headers carry a background
    The valid values for the 3rd and 4th parameter is any valid CSS background declaration, such as 'transparent url(test.gif) no-repeat'.

  3. #3
    Join Date
    Nov 2006
    Location
    Washington State
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Talking

    thank you so much! it works perfectly

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •