Rumah > hujung hadapan web > html tutorial > 怎?停止css3属性animation,求助_html/css_WEB-ITnose

怎?停止css3属性animation,求助_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Lepaskan: 2016-06-21 09:44:04
asal
1495 orang telah melayarinya

CSS3 动画 HTML

<!DOCTYPE HTML><html><head>	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	<title>Ball</title>	<style type="text/css">		*{ margin: 0;padding: 0; }		.imgBox{			-webkit-transform: scale(3);			-webkit-animation-name : 'wobble';			-webkit-animation-duration : 1.5s;			-webkit-animation-timing-function : ease-in-out;			-webkit-animation-delay : 2s;			-webkit-animation-iteration-count : 1;			-webkit-animation-direction: normal;		}		@-webkit-keyframes 'wobble'{			from{				-webkit-transform: scale(3.0);			}			to{				-webkit-transform: scale(1);			}		}							.wrap{ width: 500px;height: 500px;overflow:hidden;margin: 0 auto; }	</style></head><body><div class="wrap">	<div class="imgBox">		<img src="/static/imghw/default1.png"  data-src="http://www.mjjq.com/blog/photos/Image/mjjq-photos-900.jpg"  class="lazy"   alt="">	</div></div><script type="text/javascript"></script></body></html>
Salin selepas log masuk

初始图片是放大3倍,然后通过-webkit-animation来还原图片的比例,动画执行完毕后,,怎么又回到3倍了.?
要怎么做啊?


回复讨论(解决方案)

<!DOCTYPE HTML><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>Ball</title>    <style type="text/css">        *{ margin: 0;padding: 0; }        .imgchange{width: 100px;height: 100px;}/*自己设置大小*/        .imgBox{            -webkit-transform: scale(3);            -webkit-animation-name : 'wobble';            -webkit-animation-duration : 1.5s;            -webkit-animation-timing-function : ease-in-out;            -webkit-animation-delay : 2s;            -webkit-animation-iteration-count : 1;            -webkit-animation-direction: normal;        }        @-webkit-keyframes 'wobble'{            from{                -webkit-transform: scale(3.0);            }            to{                -webkit-transform: scale(1);            }        }        .wrap{ width: 500px;height: 500px;overflow:hidden;margin: 0 auto; }    </style></head><body><div class="wrap">    <div class="imgBox">        <img src="/static/imghw/default1.png"  data-src="http://www.mjjq.com/blog/photos/Image/mjjq-photos-900.jpg"  class="lazy"   alt="">    </div></div><script type="text/javascript">    var tt = document.querySelector(".imgBox");    tt.addEventListener("webkitAnimationEnd", function(){ //动画停止时事务               this.className += 'imgchange';    }, false);</script></body></html>
Salin selepas log masuk

.imgBox{
            -webkit-transform: scale(1);



默认情况下  动画样式处理完毕 则 普通样式发生作用

新的浏览器 css3 动画样式 可以增加一个关键字
定义动画后 用动画样式的最后样式渲染
忘记怎么拼了 你自己搜索下

新的浏览器 css3 动画样式 可以增加一个关键字
定义动画后 用动画样式的最后样式渲染
忘记怎么拼了 你自己搜索下
求具体写法啊,我也觉得应该有这么一个属性,要不然总用js也不是办法啊

Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan