js 动画效果代码,主要运用setTimeout
来源:互联网 发布:js获取div高度 编辑:程序博客网 时间:2024/05/29 02:29
代码只能对以px为单位的样式进行改变。
js Code:
function animate(ele,name,from,to,time) {time = time ||800;var interval,count,step,now;interval = 60;count =Math.round(time/interval);step = Math.round((to-from)/count);now = from;var style = document.getElementById(ele).style;function go() {count--;now = count?now+step:to;style[name] = now + "px";if(count) {setTimeout(go,interval);}}style[name] = from + 'px';setTimeout(go,interval);}
html Code:
<p ><span id ='s1'>goole!!!!!goole</span></p><input type="button" value="changeSize" onclick="animate('s1','font-size',9,50,1000)">
- js 动画效果代码,主要运用setTimeout
- JS setTimeout没有效果
- JS弹窗效果的运用(代码)
- 安卓开发20:动画之Animation 详细使用-主要通过java代码实现动画效果
- 安卓开发20:动画之Animation 详细使用-主要通过java代码实现动画效果
- 安卓开发20:动画之Animation 详细使用-主要通过java代码实现动画效果
- js动画效果
- js动画效果
- js动画效果
- js实现动画效果
- js中的动画效果
- js原生动画效果
- JS动画效果
- JS动画效果
- 常见JS动画效果
- 动画效果代码段
- 点击动画 波纹效果 主要用来做引导动画
- 瀑布流主要JS代码
- 小数化分数
- maven plugin 开发
- IT人士必去的10个网站
- robots.txt文件怎么写
- Android反编译xml文件
- js 动画效果代码,主要运用setTimeout
- 反编译APK
- ubuntu下动态链接库的使用
- myeclipse 添加头文件注释(更改头注释的内容)
- ASP.NET GUID
- 一个项目涉及到的50个Sql语句(整理版)
- office2007安装问题
- iOS解析HTML
- c语言编程百例