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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:32:29+00:00 2026-05-17T17:32:29+00:00

I want to change an image when a checkbox is clicked. Until the new

  • 0

I want to change an image when a checkbox is clicked. Until the new image is fully loaded a loader image should appear on top of the current image. While loading the opacity of the current image should also change to 0.5.

The function should therefore consist of the following steps:

On checkbox click:

  • Change img src

While loading:

  • Set opacity of current image to 0.5
  • Display loader.gif

When new image is loaded:

  • Change opacity back to 1.0
  • Hide loader.gif
  • Display new image

How can this be done with jQuery?

Thanks in advance for all proposals!

  • 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-17T17:32:29+00:00Added an answer on May 17, 2026 at 5:32 pm

    The steps should actually be

    1. on checkbox click, start to preload the new image
      Start by creating an Image object, and then setting its load property to a function that will be called once the image has been completely loaded. Then (after setting the load property) set the src attribute of the Image object we created to the Url of your image.

    2. while waiting, set the opacity, show the loader
      Opacity you can control with the css property opacity. You should have the loader already in the page but hidden, and just show it while the preloading is in progress..

    3. when preload is complete hide preloader, show image reset opacity
      The function we defined for the load attribute gets called and inside the handler we reset the opacity, hide the preloader and set the src of our element in the page to the src of the Image object we created..

    here is a full example: http://www.jsfiddle.net/kqC9U/

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

Sidebar

Related Questions

I want to change an image on a view, from a popup dialog of
I have a Blackberry project in which I want to change normal image to
I want to change the sprite image. Say for example: mainSprite=[Sprite spriteWithFile:@redFile.png]; [self addChild:mainSprite];
i have many div's with the same background image and i want change this
Possible Duplicate: Android - how to set the wallpaper image I want to change
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I want to make a fourier-transformation of an image. But how can I change
I want to change the image size when changing screen orientation. I tried to
I want to change the image in image view on button click but it
I want to change an image periodically in a UIImageView in my application, and

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.