Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 682679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:37:23+00:00 2026-05-14T01:37:23+00:00

I am using this code: $(‘.ui-accordion’).bind(‘accordionchange’, function(event, ui) { $(this).next().next().css({‘background-image’:’images/green-bg.jpg’}); //ui.newHeader // jQuery object,

  • 0

I am using this code:

        $('.ui-accordion').bind('accordionchange', function(event, ui) {
            $(this).next().next().css({'background-image':'images/green-bg.jpg'});
        //ui.newHeader // jQuery object, activated header
  //ui.oldHeader // jQuery object, previous header
 // ui.newContent // jQuery object, activated content
 // ui.oldContent // jQuery object, previous content
});

To try to change the background image of the PREVIOUS header after it changes. I see that the jquery docs supply the object for oldHeader, but I am trying to change the CSS of that element. Any ideas how I would do that?

So You go to the next one it goes green, then the current one is going to be red.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:37:24+00:00Added an answer on May 14, 2026 at 1:37 am

    You just about have it. This works for me:

      $('#div0').bind('accordionchange', function(event, ui) {
          addMessage("change");
          if (typeof ui.oldHeader != "undefined") {ui.oldHeader.css({'background': 'Pink'});}
          if (typeof ui.oldContent != "undefined") {  ui.oldContent.css({'background': 'White'}); }
          if (typeof ui.newHeader != "undefined") {ui.newHeader.css({'background': 'Yellow'}); }
          if (typeof ui.newContent != "undefined") { ui.newContent.css({'background': 'LightGreen'}); }
      });
    

    When I open a div, the header for the open div gets a yellow bg and the content gets a green bg. The just-closed header turns pink. You need to test for undefined because when closing a div and not opening another, the newHeader/Content is undefined. Likewise when opening a div, when previously all were closed, the oldHeader/Content is undefined.

    working example: http://jsbin.com/arebi4/4

    I figured this out by running the page in the debugger (either Firebug or IE8 F12 debugger works) and breaking in the accordionchange function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using this code for my inputs: $(document).ready(function(){ $('.add-news').each( function () { $(this).val($(this).attr('defaultValue')); $(this).css({'color':'#686868'
using this code I get the object representing Visual Studio: var dte2 = Marshal.GetActiveObject(VisualStudio.DTE.10.0)
Using this code I intend to populate the variables. http://www.dreamincode.net/forums/xml.php?showuser=146038 //Load comments. var commentsXML
using this code: <script src=<?php bloginfo('template_url'); ?>/scripts/hovermenus.js type=text/javascript></script> to load this script firebug is
Im using this code: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(_shrinkDidEnd:finished:contextInfo:)]; tblSimpleTable.frame = tableFrame;
I using this code for sum selected cells. Its work good but when user
In using this code (adapted from here ) I get the following error: The
Initially I thought that using this code + (NSString *)getDayOfTheWeek:(NSDate *)date format:(NSString*)format { NSDateFormatter
I am using this code in my form to create a drop down menu.
I'm creating a web service to transfer json to an iPhone app. I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.