I’m trying to do a simple hover over div and show/hide image.
Here’s the fiddle: http://jsfiddle.net/s2WWM/
What am I doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Use
mouseenterandmouseleaveinstead ofmouseoverandmouseouthttp://jsfiddle.net/s2WWM/2/
Also bind it on the container element.
The difference between these events is that
mouseenterandmouseleaveonly count when you fully leave an element whilemouseoverandmouseoutcount when you leave the element regardless if you are still inside the element.For example, when you leave an outer element for an inner element, that’s a
mouseoutbut not amouseleavebecause you are still inside the outer element.