0

in jQuery, how do I hover over a picture and show another picture? I know about the hover() takes two parameters but I am not too clear on it. Someone please explain.

Abulurd
  • 1,018
  • 4
  • 15
  • 31

2 Answers2

1
$( ".your-img" ).hover(
    function() { // this function will be executed when the mouse pointer enters your img
        // try to show your second picture
    }, function() { // when the mouse pointer leaves your img
        // hide the second picture
    }
);

You can use css to style your second picture hidden as default.

spidermanit
  • 353
  • 1
  • 3
  • 7
1

Here is a fiddle for ya. http://jsfiddle.net/qYb5m/

I think you're looking for a:

$('img').hover(
    function() {
        $(this).attr();
    },
    function() {
        $(this).attr();
    }
);

As you can see. There are a few customizable options with the attr() tag.

The disappointed cat is because if you don't post a fiddle or code, it doesn't seem as if youve tried.

tgeery
  • 174
  • 6