如何用js设置@keyframe的动态参数

keyframe_name keyframe_name 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
正常@keyfram的使用
.class{
animation-name:person-slow;
animation-duration:5s ;
animation-iteration-count:infinite ;
animation-timing-function: linear;
}
@keyframes person-slow{
0%{width:10px;}
25%{width: 20px;}
50%{width: 30px;}
75%{width: 40px;}
100%{width:10px;}
}

意思是让class这个容器宽度在5s内的变化
但每一次的变化宽度都已经写死了,这样兼容性不是和好,在不同大小窗口打开,样式很难看,我想让宽度可窗口成比例,是动态参数(例如将@keyframes person-slow中的参数一次设置为widthX*0.1,widthX*0.2,widthX*0.3,widthX*0.4,widthX*0.1),这样参数的值就不是固定的了,可以随着容器宽度(widthX)进行放缩,应该如何实现???
再次谢谢各位热爱前段、热爱动漫的大牛了!
...全文

相关推荐

Vue.js Ajax动态参数与列表显示实现方法

Vue.js简介 vue是法语中视图的意思,Vue.js是一个轻巧、高性能、可组件化的MVVM库,同时拥有非常容易上手的API。 一、动态参数显示 ajax异步请求后,接收到返回的data参数并显示在前端 1.1 引入js,也加入了jQuery [removed][removed] [removed][removed] 1.2 html <div id=app> <p>{{ message }}</p>

weixin_38723236

javascript 动态参数判空操作

在做交友中心的页面的时候,有一个javascript函数,它的第二个参数是动态的。

weixin_38633157

vue v-on:click传递动态参数的步骤

主要介绍了vue v-on:click传递动态参数的步骤,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

weixin_38687807

JavaScript(js)设置默认输入焦点(focus)

常常会在回复和引用里使用此功能,即单击回复或引用,如让输入焦点出现在留言输入框中,如果使用锚来定位,输入焦点就不能激活了。 代码如下: [removed]document.getElementById(“id”).focus(); 或[removed]document.all.id.focus(); 或[removed]document.all.name.focus(); 例子: 代码如下: &lt;input type=”text” name=”tt” id=”tt”&gt; &lt;input type=”button” name=”bt” id=”bt” onclick=”javascr

weixin_38552871

JS设置cookie、读取cookie

JavaScript是运行在客户端的脚本,因此一般是不能够设置Session的,因为Session是运行在服务器端的。 而cookie是运行在客户端的,所以可以用JS来设置cookie。 js设置cookie方法汇总: 第一种: [removed] //设置cookie function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toUTCString(); docum

weixin_38685876
评论 3
收藏 已收藏
分享
返回顶部
keyframe_name
CSS 61,116 成员 60,701 内容