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 6244749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:22:52+00:00 2026-05-24T12:22:52+00:00

I really cannot find the solution on other questions! I have that accordion menu

  • 0

I really cannot find the solution on other questions!

I have that accordion menu similar to this:

<div id="accordion" style="font-size:1em;">
            <h3 id="lactics" style="margin-top:50px"><a href="#">Làctics</a></h3>
            <div>
                <p><a href="#">Iogurts</a></p>
                <p><a href="#">Pastissos</a></p>
                <p><a href="#">Llet</a></p>
                <p><a href="#">Formatges</a></p>
                <p><a href="#">Altres</a></p>
            </div>
            <h3 id="embotits"><a href="#">Embotits</a></h3>
            <div>
                <p><a href="#">Pernil</a></p>
                <p><a href="#">Embotits</a></p>
                <p><a href="#">Botifarres</a></p>
            </div>
</div>

And I have that jquery code:

$(document).ready(function() {
$(function() {
    $( "#accordion" ).accordion({
        collapsible: true,
        active: true,
        autoHeight: false,
    });
})
$('#lactics').click(function() {
    $("#prods_vcts").css("background","url(images/taula_vcts_lactics.png) no-repeat");
})
$('#embotits').click(function() {
    $("#prods_vcts").css("background","url(images/taula_vcts_embotits.png) no-repeat");
});
});

The idea is that the background of the page changes when the user clicks in other header of the menu.

However, I cannot find the way to just set the background to ‘none’ when there is no header active (that is, all the headers are closed). Then, the background is the page standard. I’ve tried binds and other things, but I really cannot do it.

Any ideas?

  • 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-24T12:22:53+00:00Added an answer on May 24, 2026 at 12:22 pm

    You can bind to the change event of the accordion. When all panes are collapsed, ui.newHeader will be an empty jQuery object:

    $("#accordion").accordion({
        collapsible: true,
        active: true,
        autoHeight: false,
        change: function(event, ui) {
            if (!ui.newHeader.length) {
                $("#prods_vcts").css("background-image", "none");
            } else {
                $("#prods_vcts").css("background", "url(images/taula_vcts_"
                    + ui.newHeader.attr("id") + ".png) no-repeat");
            }
        }
    });
    

    If you want the background image to change as soon as the accordion panes start animating, you can bind to the changestart event instead.

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

Sidebar

Related Questions

Hi I have been looking around for this solution but cannot find it. Have
I'm sure this has been answered before, but I really cannot find it. I
I have a really frustrating error that I've spent hours looking at and cannot
I know there are many other questions similar to this one, but none of
I've looked for days and I cannot find a solution to this problem. It's
I just cannot figure this out, it looks really simple but I'm relatively new
This is really weird, and I cannot see why this is happening. In the
I'm really having a problem finding out how to fix this. I cannot seem
This is a really basic issue, but I'm new to perl and cannot work
I know this is probably really obvious, but I cannot figure out why I

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.