HTML 使用JS 原生Animation API实现锚点链接动画切换
查询资料发现大部分文章使用jquery来实现动画效果,由于限制无法实现,尝试原API方式实现动画切换效果,当前demo如下,仅抛砖引玉(待完成 如何使两个界面切换能够连贯起来待尝试中)
更多信息可参考一下文章
Web Animations
https://drafts.csswg.org/web-animations/#animations
<!DOCTYPE html>
<html>
<head>
<style>
.wolfplain
{
width:200px;
height:50px;
background:red;
position:relative;
animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite; /*Safari and Chrome infinite*/
}
@keyframes mymove
{
from {left:0px;}
to {left:200px;}
}
@-webkit-keyframes mymove /*Safari and Chrome*/
{
from {left:0px;}
to {left:200px;}
}
</style>
</head>
<body>
<p class="note"><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animat