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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:29:29+00:00 2026-06-11T02:29:29+00:00

As my title explains, I have a background image I am using and want

  • 0

As my title explains, I have a background image I am using and want it to change when I hover over a div in a certain area of the page.

Currently my background image for #main is 4Era_home.jpg and when I hover over #television I would like that background image to change to 4Era_home_tv.jpg.

I hope this makes sense as I have been looking online but cannot find a solution that will work. I know that css will not work for this so any help with the jquery or javascript for this would help.

<div id="main">
    <div id="television">
        <a href="#" id="tv_glow">test</a>
    <div>
</div>
  • 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-06-11T02:29:30+00:00Added an answer on June 11, 2026 at 2:29 am

    You can use CSS as well as jQuery.

    Update your HTML to use a default class pointing to the default image, in te below example home:

    <div id="main" class="home">
        <div id="television">
            <a href="#" id="tv_glow">television test</a>
        <div>
    </div>​
    

    Use CSS styles similar to the below to define the require images:
    (You can ginore the styles I used on #main they are just for the DEMO, the styles you are interested in are .home and tv)

    #main{
      background-repeat:no-repeat;
      text-align: center; 
      width:200px;
      height:200px;
    }
    
    .home
    {
      background-image:url('http://www.fileden.com/files/2012/6/19/3318010/Eraser.png');
    }
    
    .tv
    {
      background-image:url('http://www.fileden.com/files/2012/6/19/3318010/Ok.png');
    }
    

    Switch classes using jQuery toggleClass() like this:

    $("#television").hover(function() {
        var $parent = $(this).parent();
        $parent.toggleClass("home, tv");
    }, function() {
        var $parent = $(this).parent();
        $parent.toggleClass("home, tv");
    });​
    

    DEMO – Switching background image in parent element

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

Sidebar

Related Questions

As the title explains, I have one container div, containing two floating divs of
As the title explains, I have an Excel 2003 workbook and I'm copying a
The title may have been confusing, but please let me explain: Currently when I
I have customized UIButton with the following properties: 84x44 frame 84x44 background image 32*32
I want to format the posts on a blog to have stacking 'title divs'
The title explains it well. I have set up Notepad++ to open the Python
The title explains all... I have this snippet of code in my application: String
Not sure the title explains what I want to do, so here goes: I
Title explains it pretty much. After installing Boost module, i have troubles with uploading
Not sure if the title explains itself, but probably not! Anyway, I have 50

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.