Home > Web Front-end > HTML Tutorial > 怎?停止css3属性animation,求助_html/css_WEB-ITnose

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

WBOY
Release: 2016-06-21 09:44:04
Original
1455 people have browsed it

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>
Copy after login

初始图片是放大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>
Copy after login

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



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

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

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

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template