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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:26:06+00:00 2026-06-07T19:26:06+00:00

I want to be able to fade one image into another on hover and

  • 0

I want to be able to fade one image into another on hover and then fade out the hovered image once the mouse leaves the object. Because its tightly packed within a DIV i do not want any space around it, so was trying to use just SPAN which is not working. Any idea?
MY scripts are the following:

<style>
.fade {
          position: relative;
    border: 0;
    margin: 0 auto;
    padding: 0;
        }

        .fade div {
          position: absolute;
          top: 0;
          left: 0;
          display: none;
          height: 100px;
          width: 240px;
    border: 0;
    margin: 0 auto;
    padding: 0;
        }
-->
</style>

    <script type="text/javascript">
    <!--

    $(function () {
        // find the div.fade elements and hook the hover event
        $('span.fade').hover(function() {
            // on hovering over find the element we want to fade *up*
            var fade = $('> div', this);

            // if the element is currently being animated (to fadeOut)...
            if (fade.is(':animated')) {
                // ...stop the current animation, and fade it to 1 from current position
                fade.stop().fadeTo(250, 1);
            } else {
                fade.fadeIn(250);
            }
        }, function () {
            var fade = $('> div', this);
            if (fade.is(':animated')) {
                fade.stop().fadeTo(3000, 0);
            } else {
                fade.fadeOut(3000);
            }
        });
    });

    //-->
    </script>

HTML:

<span class="fade">
        <img src="theImages/sApproveBW.jpg" alt="Who we are" />
        <div>
            <img src="theImages/sApprove.jpg" alt="Who we are" />
        </div>
    </span><img src="theImages/bApprove.jpg" height=100 width=240 /><br><img src="theImages/tApprove.jpg" height=100 width=240 />

I have a little white space below the first image. Anyway to get rid of it?

How it looks: http://img805.imageshack.us/img805/7417/imgct.png

I want to get rid of the white space in between the first image on top from the image thats green.

my New HTML page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>Fade Method 1 (two images)</title>
    <style type="text/css" media="screen">
    <!--
* {
    margin: 0;
    padding: 0;
}
        img { border: 0;
display: block;
}

.fade {
    position: absolute
        }

        .fade div {
          position: absolute;
          top: 0;
          left: 0;
          display: none;
          height: 100px;
          width: 240px;
        }

    -->
    </style>

<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>


    <script type="text/javascript">
    <!--

    $(function () {
        // find the div.fade elements and hook the hover event
        $('span.fade').hover(function() {
            // on hovering over find the element we want to fade *up*
            var fade = $('> div', this);

            // if the element is currently being animated (to fadeOut)...
            if (fade.is(':animated')) {
                // ...stop the current animation, and fade it to 1 from current position
                fade.stop().fadeTo(250, 1);
            } else {
                fade.fadeIn(250);
            }
        }, function () {
            var fade = $('> div', this);
            if (fade.is(':animated')) {
                fade.stop().fadeTo(3000, 0);
            } else {
                fade.fadeOut(3000);
            }
        });
    });

    //-->
    </script>
</head>
<body id="page">
    <span class="fade">
        <img src="theImages/sApproveBW.jpg" alt="Who we are" />
        <div>
            <img src="theImages/sApprove.jpg" alt="Who we are" />
        </div>
    </span>
<img class=t src="theImages/bApprove.jpg" height=100 width=240 />
<img class=t src="theImages/tApprove.jpg" height=100 width=240 />
</body>
</html>

But now i have two images, the second one(green) went under the first one(black) and the third one(yellow) is right below the black one.
Here is the example: http://img266.imageshack.us/img266/9557/imgdu.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-07T19:26:08+00:00Added an answer on June 7, 2026 at 7:26 pm
    img {
        display:block;
    }​​​​
    .fade div {
        margin-top:-100px !important;
    }
    

    Remove the top:0px; left:0px; and add the above code and that should sort it out.

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

Sidebar

Related Questions

what I want is to fade the first image and show the next one..
I want to be able to take an image that i have already captured
wat i want is to show an image in image view and fade the
I want to be able to do a cross fade transition on large images
I'm using LaTeX and BibTeX for an article, and I want to able to
Want to be able to provide a search interface for a collection of objects
I want to be able to replicate only the folder structure (not the contents)
I want to be able to do the following actions with a form submit
I want to be able to hide a selector if it contains any data.
I want to be able to create a Pandas DataFrame with MultiIndexes for the

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.