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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:29:10+00:00 2026-05-23T16:29:10+00:00

My brain is going round in circles trying to figure this out – I

  • 0

My brain is going round in circles trying to figure this out – I think I need the help of someone with a bigger brain! Admittedly I’m a jQuery novice so I’m hoping the solution to my problem is fairly simple. I’m trying to write some code that will toggle the background image of a div (which has already been specified by a stylesheet to introduce a :hover function). The div’s that I’m affecting also function to toggle other div’s in a question/answer situation.

At present, I’ve managed to get to the stage (with the following code) that the jQuery DOES change the background image as intended (in this case, from green ‘/img/bg/nav-giclee.png’ to black ‘/img/bg/nav-down.png’);

HOWEVER what I need is for only one of the divs to be black at any one time, ie when selected. At the moment after being clicked and turning to black, the div remains black even when an alternative DIV is clicked. I suppose what I’m aiming for is for clicking on a DIV to reset the background images of the other DIVs (whilst not interfering with their show/hide question/answer features). Have I overcomplicated this explanation?!?

The working page is at: http://sketch360test.co.uk/giclee.php/… Many thanks in advance for any benevolent help…

The jquery I’m using for now is:

jQuery.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

$(function() {
    $("#answer .views-row").hide();
    $("#question .views-row").click(function(){
        var i = $(this).index();
        $("#answer .views-row").eq(i).toggle("slow").siblings().hide();
        $(".question").eq(i).css("background-image", "url(/img/bg/nav-down.png)");
    });
});
  • 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-23T16:29:11+00:00Added an answer on May 23, 2026 at 4:29 pm
    $(function() {
        $("#answer .views-row").hide();
        $("#question .views-row").click(function(){
            var i = $(this).index();
            $("#answer .views-row").eq(i).toggle("slow").siblings().hide();
            $(".question").css("background-image", "url(/img/bg/nav-giclee.png)").eq(i).css("background-image", "url(/img/bg/nav-down.png)");
        });
    });
    

    Also, I would recommend adding / removing a CSS class rather then setting background-image manually – you may find out than you have to modify more properties, ie. border.

    UPDATE

    $(".question").removeClass("selected").eq(i).addClass("selected");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been racking my brain trying to figure this out. Here is the scenario.
been taxing my brain trying to figure out how to perform a linq xml
I nearly have this going but don't have sufficient brain power to work out
I'm trying to wrap my brain about how to do this. We need to
My brain its going to explode.. why this dont work? im trying to animate
I've had my brain wrinkled from trying to understand the examples on this page:
I've racked my brain trying to find an easy way to do this and
I'm trying to figure out how to capture data from a form using EditText
I am going brain dead on this; I have several List' defined, based on
I have got a bit of 'brain fade' going on this afternoon, so if

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.