Hi i have this javascript function which fades in a div if a user hovers over another div. And when they hover off or more the mouse away the div fades back out.
Does anyone know how i can loop this to run an infinite number of times because at the moment it only does it the once.
<script>
$(".change-profile-pic").hide();
$('.img-with-border').hover(function () {
if ($('.change-profile-pic').is(":hidden")) {
$('.change-profile-pic').fadeTo(0, 500);
} else {
$('.change-profile-pic').fadeTo(500, 0);
}
});
</script>
If you really want to use jQuery (not CSS transitions) then with
.hover,.fadeInand.fadeOutand my understanding ofEdit for no fade out when hovering over
.change-profile-picExample fiddle (based on jfriend00‘s demo with JavaScript from this answer instead)