What I want to achieve:
- When hovering over the image, it fades out.
- Text should fade in after the image fades out.
- Text should fade out when the mouse leaves.
- The original image should fade back in.
- End with the original image and no text displayed.
Issue:
I have the steps working, but they seem to be looping, causing the image and text to flash on and off. Any suggestions?
$("img").hover(function(){
$(this).fadeOut();
$("p").text("CHAIR").fadeIn();
});
$("p").mouseleave(function(){
$("p").fadeOut();
$("img").fadeIn("slow");
});
p {
display: none;
position: absolute;
left: 100px;
top: 150px;
font-size:45px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img id="chair" src="http://edufurniture.com/images/catalog/category13.jpg" alt="">
<p></p>