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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:25:13+00:00 2026-06-01T13:25:13+00:00

I have an IMG tag with a grayscale image. I hooked up a Hover()

  • 0

I have an IMG tag with a grayscale image. I hooked up a Hover() event in order to change the “src” to a color image on hover, and back to grayscale on mouse-out.

This works just fine, however the change is abrupt. I’d like to add a slight fadeIn() to the effect so that the color appears to fadein and fadeout. I wrote the following which I thought would work, but doesn’t. (The image changes, but there is no fade or delay to the effect). What am I doing wrong?

            $("#showForm").hover(
              function () {
                $(this).fadeIn('slow', function(){
                    $(this).attr("src", 'images/AddButtonSmall.gif');
                });
              }, 
              function () {
                $(this).fadeIn('slow', function(){
                    $(this).attr("src", 'images/AddButtonSmallGray.gif');
                });
              }
            );
  • 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-01T13:25:14+00:00Added an answer on June 1, 2026 at 1:25 pm

    Here are a couple solutions. Your code doesn’t work because you are setting the source which changes the image immediately. It’s probably easier just to load both images, overlay them with CSS and then fade the color one in out when the parent container is moused over. Alternatively you could cross fade them

    css

    .fader { display: inline-block; }
    .fader img:last-child {
        position: absolute;
        top: 0; 
        left: 0;
        display: none;
    }​
    

    html

    <div class="fader">
        <img src="http://placehold.it/300x300/000fff" />
        <img src="http://placehold.it/300x300/fff000" />
    </div>​
    

    fade in on mouseover

    http://jsfiddle.net/Xm2Be/3/

    $('.fader').hover(function() {
        $(this).find("img:last").fadeToggle();
    });​
    

    cross fade

    http://jsfiddle.net/Xm2Be/2/

    $('.fader').hover(function() {
        $(this).find("img").fadeToggle();
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following image tag in a JSP: <img id=validationGraph src=/myapp/MyServlet?mode=myMode usemap=#validationMap border=0
suppose i have one div and div has img tag like <div><img src='img1.png'/></div> so
I have a img tag in IE9, like <img id=xxx /> , without src
Essentially I have an img tag with a src attribute of /ChartImg.axd?i=chart_0_0.png&g=06469eea67ea452b977f8e73cad70691 . Do
I have an IMG tag in my HTML5 document that reads: <img src="elements/background.png" alt=""
Does asp:Image tag perform faster than normal HTML img tag? I have 20 images
I have this piece of code: <ice:panelGroup menuPopup=menuPopup1 onclick=fireContextMenu(this, event);> <img src=/resources/images/external/bg-suppliers.gif> </img> </ice:panelGroup>
I have a img tag as <img src=http://######/index.php?option=com_payplans&view=cron alt=./> But src is not a
I have used a tag with attribute src=mydirectory/myimage.gif. If the image is not present
i have one div and div has one img tag but image is not

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.