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.
Asked
Active
Viewed 75 times
0
-
https://www.google.ca/?gfe_rd=cr&ei=0N97U4PwOeGV8QeLx4HQBg#q=jquery+hover+example – Shan Robertson May 20 '14 at 23:06
2 Answers
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