I am trying to make it so a img changes to a gif when the user is scrolling on a site.
HTML
<img src="img/giphy.gif" alt="" id="imgAnimate">
JQUERY
$(document).ready(function()
{
$("#imgAnimate").hover(
function()
{
$(this).attr("src", "img/giphy.gif");
},
function()
{
$(this).attr("src", "img/giphy.png");
});
});
I got this but now is it when you hover over the img it changes into a gif. How can I make this happen when user is scrolling.
Thanks you if you can help me.