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

  • Home
  • SEARCH
  • 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 7536323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:32:34+00:00 2026-05-30T06:32:34+00:00

I am trying to replace an image with another image on rollover and use

  • 0

I am trying to replace an image with another image on rollover and use a fade.

I have 2 images water_bag.jpg and water_bag-hover.jpg

I am trying to replace one on rollover with the following javascript:

<script type="text/javascript">
            $(document).ready( function() {

$('.my_img').parent().append($('.my_img').clone().attr('src','-hover.jpg').fadeIn('slow'))


});
</script>

My html is just this:

<a  href="<?php echo tep_href_link(FILENAME_EVENTS); ?>"><img src="images/home_buttons/water_bag.jpg" alt="watch la vie en couleur"   border="0" align="left" class="my_img" /></a>

What am I doing wrong?

  • 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-30T06:32:36+00:00Added an answer on May 30, 2026 at 6:32 am

    Here’s simple way: set one image as a background, and fade in another on top:

    <img src="http://i.imgur.com/vdDQgb.jpg" hoverImg="http://i.imgur.com/Epl4db.jpg"> 
    

    JS:

    $('body').find('*[hoverImg]').each(function(index){
        $this = $(this)
        $this.wrap('<div>')     
        $this.parent().css('width',$this.width())  
        $this.parent().css('height',$this.width())
        $this.parent().css('background-image',"url(" + $this.attr('hoverImg')+")")
            $this.hover(function() {
                $(this).stop()
                $(this).fadeTo('',.01)    
            },function() {
                $(this).stop()
                $(this).fadeTo('',1)             
            })                    
    })
    

    DEMO: http://jsfiddle.net/Diodeus/gYyBL/

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

Sidebar

Related Questions

I am trying to use jquery to replace an image on rollover (with fade)
I'm trying to use GreaseMonkey to replace the background image of a DIV on
I am trying to replace the default image with a custom one, but with
Using jQuery, I'm trying to replace all links to images (.jpg, .png, .tiff, .gif)
I am trying to replace an image when a link in another part of
I am trying to replace text with images (each character would have its own
I have image map where i am trying to open another page by using
I'm trying to replace certain text inside the div info when an image (which
I get the following error when trying to upload a .JPG file. Warning: getimagesize()
I'm trying to implement the following: I have an Items Manager, that has an

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.