jQuery中,如何点击button让css动画从头重新播放?

qqbnb889 2016-09-09 05:51:46

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
@keyframes titan{
10% {opacity: 1;left:0px; top:0px;}
50%{opacity: 0;left:50px; top:0px;}
100%{opacity: 1;left:0px; top:0px;}
}

#box{
background-color:#0006cf;
width:200px;
height:200px;
margin-left:10px;
font:92px/100px Futura;
letter-spacing:8px;
animation:titan 2s ease-in-out;
position:relative;
}
button{width:80px;
height:30px;
animation-play-state:running;}
</style>
</head>

<body>
<div id="box"></div>
<button></button>
</body>
</html>


RT,点击按钮让css动画重新从头播放,求解答~
...全文
456 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Xiao灬佳 2016-09-09
  • 打赏
  • 举报
回复
JQ animate()

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧