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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:40:47+00:00 2026-06-07T12:40:47+00:00

I want to Fade out the image Preload a replacement image Change the image

  • 0

I want to

  1. Fade out the image
  2. Preload a replacement image
  3. Change the image source to display the new image
  4. Fade in the (new) image

For some reason, though when the image fades back in there is a very brief moment where the old image is seen then replaced by the new image. I don’t think this is a timing conflict between image operations… what else would cause this flicker?

// old image: about.jpg
// new image: contact.jpg


$('#content').fadeTo(1500, 0.01, function(){
    var container = $(this);

    // gather image information
    var src = img.parent().attr('href');
    imgData = { 'alt': img.attr('alt'), 'src': src, 'cap': '' };

    // change background image & caption (after image has been cached)
    var imgSrc = sanitizeBackgroundImage( imgData );
    $.get( imgSrc, function(data) {

        // set background image src to preloaded image
        $("#content>img").attr({"src": imgData.src});
        $("#content>img").attr({"alt": imgData.alt});

        // update caption text
        $('#bottom-caption').html('<span>' + imgData.cap + '</span>');

        // fade image container back in
        console.log( 'before fadeIn: ' + $("#content>img").attr("src") );
        container.fadeTo(750, 1);                   
    });
});

The console correctly reads

before fadeIn: /images/large/contact.jpg
  • 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-07T12:40:48+00:00Added an answer on June 7, 2026 at 12:40 pm

    Can you try to start fade-in at image load? I think fade-in is started before the image is fully loaded and displayed.

    $("#content>img").load(function() { $('#content').fadeTo(750, 1); });
    
    $('#content').fadeTo(1500, 0.01, function(){ 
      var container = $(this); 
    
      // gather image information 
      var src = img.parent().attr('href'); 
      imgData = { 'alt': img.attr('alt'), 'src': src, 'cap': '' }; 
    
      // change background image & caption (after image has been cached) 
      var imgSrc = sanitizeBackgroundImage( imgData ); 
      $.get( imgSrc, function(data) { 
    
        // set background image src to preloaded image 
        $("#content>img").attr({"src": imgData.src}); 
        $("#content>img").attr({"alt": imgData.alt}); 
    
        // update caption text 
        $('#bottom-caption').html('<span>' + imgData.cap + '</span>');  
      }); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I want to display one uniformly semi-transparent image, and then 'fade out' this
Hi guys I want to create an intro image (fade in and fade out
I have LI that I want to fade out and back in. Within the
I have a problem where I want to fade out an image, then move
I want to have fade-in, fade-out effect for two image views I have two
This question has been asked here, Image Replacement (gallery style) with Fade-In's / Fade-Out's
I want to display a splash screen animation where an image fades in and
Below is some code I'm working with. What I want/expect: Image fades in; sound
I want to have an image fade out slowly on load. Idea is that
There was a fade out sample in the internet.. http://docs.dojocampus.org/dojo/fadeOut?t=tundra but i want to

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.