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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:53:40+00:00 2026-06-12T07:53:40+00:00

I saw a solution to the former part of the question and it worked

  • 0

I saw a solution to the former part of the question and it worked great when I used it,I’ve included it below (Thanks to rsofter if you see this!). I want to know what must be added in order to add fadeIn, fadeOut effects to the background image?
The solution I came across was:

You can use jquery to do this.

Your markup:

<div id="div1"></div>
<div id="div2"></div>

Your script:

$("#div1").mouseover( function() {
    $("#div2").css("background-image", "url('image.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-06-12T07:53:42+00:00Added an answer on June 12, 2026 at 7:53 am

    You can’t animate a background-image’s opacity. It’s not possible. The workaround is to place an <img> within a shared parent container of <div id="2">

    Scenario ->

    <div id="1">
        div 1
    </div>
    <div id="wrapper">
        <img src="path/to/my/background/image"/>
        <div id="2">
    
        </div>
    </div>
    

    The relative css ->

    #wrapper{
        position:relative;
    }
    #wrapper img{
        position:absolute;
            top:0;
            left:0;
        z-index:-1
    }
    #wrapper #div2{
        display:block;
        height: // this value should be the same as the background images size.
        width:  // this value should be the same as the background images size.
    }
    

    the jQuery ->

    $('#div1').hover(function(){
        $('#wrapper img').fadeOut('slow', function(){
            //this is the callback function of fadeout, now change the background image URL.    
            $(this).css('background-image', 'location/to/my/new/image.ext');
            var checkForDelay = setTimeout(function(){
                //if they haven't moused out after 3 seconds, then show them the new background.
                $('#wrapper img').fadeIn('slow');
            }, 3000);
        });
    }, function(){
       clearTimeout(checkForDelay);
       $('#wrapper img').fadeIn('slow');
    });
    

    jsFiddle outlining similar principals

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

Sidebar

Related Questions

Checking Express docs I saw this kind of solution below: app.all('/*', function(req, res) {
I saw in this post a solution that fits exactly my needs https://stackoverflow.com/a/8858815/1462911 .
I saw this thread but the solution is not what I'm looking for. I
I saw this solution http://jsfiddle.net/gronky/GnTDJ/ and it works. That is, when you input 25,
I saw this ECLiPSe solution to the problem mentioned in this XKCD comic. I
I saw a similar question and hoped for a solution, but simply giving an
I have found the following code on the internet, when I saw this solution
I saw here a solution, but i don't want wait until the key is
I saw this: http://yukelzon.blogspot.com/2005/07/python-locks.html when looking for a solution to add some locking to
I saw this question on the Related section and after going through some of

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.