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

  • Home
  • SEARCH
  • 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 4017644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:53:11+00:00 2026-05-20T09:53:11+00:00

Hi Have a menu which look like this <div id=products_menu class=span-9 last> <ul> <li><a

  • 0

Hi Have a menu which look like this

<div id="products_menu" class="span-9 last">
 <ul>
   <li><a href="#">beauty</a></li>
   <li><a href="#">fragrence</a></li>
   <li><a href="#">at home</a></li>
 </ul>
</div>

I would like to use jquery to change the CSS background image of the main div based on the hover of one of the links.

for example when a user hovers over the Beauty link then change the css bg-imge to x and if the user hovers over fragrance then chaneg the css bg-image to y.

Any help would be great

Thanks

  • 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-20T09:53:12+00:00Added an answer on May 20, 2026 at 9:53 am

    Sitting here in class kinda bored I decided it would be more useful to you and everyone if there was a real solution rather than the “Add an ID” and use common JQuery solution so here we go.

    This solution will allow any size list and requires an array of strings that contain the path to your desired background images the array should linearly relate the list meaning the array[0] should be the image for elem 1 in the list and so on.

    now for the code. Lucky for you with this solution you do not have to change any html.

    var backgroundImages = ["path_to_bg_1", "path_to_bg_2", "path_to_bg_3", "path_to_bg_4"];
    $("#products_menu li").hover(function () {
        $("#products_menu").css("background", "url("+backgroundImages[$(this).index()]+")")
    }, function () {
        $("#products_menu").css("background", "url(PATH_TO_DEFAULT)")
    })
    

    and finally a proof of concept at jsfiddle
    http://jsfiddle.net/k8ywX/

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

Sidebar

Related Questions

I'm trying to create an expandable menu item in android, which will look like
I have a asp:menu object which I set up to use a SiteMapDataSource but
I have a menu running off of a sitemap which one of the SiteMapNode
I have a vertical menu in my system which is basically made of HTML
I have a web system which has a classical parent-children menu saved in a
I have a menu div that I want to slide down so it's always
I recently used display:table and display:table-cell properties. It was like this, <div id=main style=display:table>
I have a navigation menu which I need to include on all my pages....through
I have a menu for which I wanted all of the space around the
I'm working on this menu for a intranet system. I have a menu system

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.