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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:08:45+00:00 2026-06-01T10:08:45+00:00

I want to make a background image disappear. It works. But it fails when

  • 0

I want to make a background image disappear. It works.
But it fails when I try to delay it or to animate it.
Any guess what it’s wrong and how to do it well?

$(function(){      
    $("#foto1").click(function() {
        $("#foto1").delay(1000).animate.css({"background":"none"},2000);
    }); 
})

http://jsfiddle.net/78W3u/

  • 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-01T10:08:47+00:00Added an answer on June 1, 2026 at 10:08 am

    This will fadeout an image : http://jsfiddle.net/2MQeC/

    $(function(){      
        $("#foto1").click(function() {
            $("#foto1").fadeOut(2000);
        }); 
    })​
    

    — EDIT —

    This will animate the background independently of the image : http://jsfiddle.net/2MQeC/1/

    #foto1 { 
        background: black; 
      -webkit-transition: background 1.5s ease;  /* Saf3.2+, Chrome */
         -moz-transition: background 1.5s ease;  /* FF4+ */
          -ms-transition: background 1.5s ease;  /* IE10 */
           -o-transition: background 1.5s ease;  /* Opera 10.5+ */
              transition: background 1.5s ease;
    }
    

    ​

    $(function(){      
        $("#foto1").click(function(){
            $this = $(this);
            setTimeout(function(){
                $this.css({
                    background: 'green'
                });
            }, 1000); // delay
        }); 
    })​;
    

    As you can see, this rely on CSS3 transitions for background animation.

    A better cross browser solution would be to use jQuery .animate() function.
    But you can’t modify as many properties as .css() could.

    Extract from jQuery .animate() documentation :

    Most properties that are non-numeric cannot be animated using basic
    jQuery functionality (For example, width, height, or left can be
    animated but background-color cannot be, unless the
    jQuery.Color() plugin is used).

    However, you could change your markup and separate your image and your background in two div who are superimposed. This could simplify what you are trying to do.

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

Sidebar

Related Questions

I have a div, and I want to make a whole background image fit
I want to make a png Image as the background image of a LWUIT
I have image 1*910px high, I want to make background. here is my css:
I have this code to make a Jbutton with icon image ,and it works.But
I want to make a DIV background (which doesn't have a background color) flash
I want to make the background of a QDialog transparent so that I can
is there any possibility how to load an image with jQuery in background and
I am trying to make a background image smoothly fade in when the class
I'm trying to make a jQuery image overlay on div hover function, but I'm
I want make a carousel. But not a simple carousel with images. I have

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.