当你将鼠标悬停在它上面时是否可以启动.gif动画,当你没有悬停在它上面时暂停它?我不想在停止悬停在图像上时将图像重置为动画的开头.
编辑:谢谢你的帮助,但没有像我想要的那样工作.我找到的最佳解决方案是:
HTML:
<img id="gif1" src="static1.jpg">
Run Code Online (Sandbox Code Playgroud)
JS:
$("#gif1").hover(
function() {
$(this).attr("src", "animate1.gif");
},
function() {
$(this).attr("src", "static1.jpg");
}
);
Run Code Online (Sandbox Code Playgroud)
所以,只是重置东西.