有没有办法捕获动画图像并将其设为静态图像(PNG/JPEG)?
我想捕获下面的动画图像以显示它的静态图像。因此,我可以添加播放按钮来切换 GIF 图像和静态图像。
HTML:
<div class="image_wrapper">
<img class="animated_gif" src="http://i.imgur.com/zY4nD.gif" />
<img class="still_img" src="" />
</div>
<a href="#" class="play_btn">Play/Pause</a>
CSS:
.image_wrapper{
border-top-left-radius: 4px;
border-top-right-radius: 4px;
background: #ddd;
width: 150px;
height: 150px;
padding:10px;
}
.animated_gif{
width:100%;
height:150px;
display:none;
}
.play_btn{
background:#2FB82B;
padding:5px;
text-decoration:none;
color:white;
font-weight:bold;
border-radius:4px;
margin: 42px;
position:relative;
top:10px;
}
.play_btn:hover{
background:#4DD849;
}
最佳答案
试试这个 Demo
$('.play_btn').on('click', function() {
$('img').toggle();
})
关于javascript - 如何捕捉动画GIF并显示静态图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30252238/