PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

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

原创
2016-06-21 09:44:04 1289浏览

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="http://www.mjjq.com/blog/photos/Image/mjjq-photos-900.jpg" alt="">	</div></div><script type="text/javascript"></script></body></html>

初始图片是放大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="http://www.mjjq.com/blog/photos/Image/mjjq-photos-900.jpg" alt="">    </div></div><script type="text/javascript">    var tt = document.querySelector(".imgBox");    tt.addEventListener("webkitAnimationEnd", function(){ //动画停止时事务               this.className += 'imgchange';    }, false);</script></body></html>

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



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

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

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

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。