多个div 缓冲运动—变宽
来源:互联网 发布:qq阅读网络异常怎么办 编辑:程序博客网 时间:2024/04/29 21:17
css:
div{ width:100px; height:100px; background: yellowgreen; margin-top:20px;}html:
<div></div><div></div><div></div>js
window.onload=function () { var oDiv=document.getElementsByTagName("div"); for(var i=0;i<oDiv.length;i++){ oDiv[i].timer=null;//给每个div设置timer属性(每个div都有个timer,这样就不会影响其他定时器了) oDiv[i].onmouseover=function () { startMove(this,300) } oDiv[i].onmouseout=function () { startMove(this,100) } } //运动框架 var timer=null; function startMove(obj,itarget) { clearInterval(obj.timer); obj.timer=setInterval(function () { var ispeed=(itarget-obj.offsetWidth)/8; ispeed=ispeed>0?Math.ceil(ispeed):Math.floor(ispeed); if(obj.offsetWidth==itarget){ clearInterval(obj.timer) }else{ obj.style.width=obj.offsetWidth+ispeed+"px"; } },30) }}
阅读全文
0 0
- 多个div 缓冲运动—变宽
- 一个div 缓冲运动—变宽
- JS运动之多物体框架--多个div变宽
- 多个div变宽
- 缓冲运动-1-多个div运动【问题】.html
- 缓冲运动-1-多个div运动【解决].html
- (42)JS运动之多物体框架--多个div变宽
- 缓冲运动-2-多个div淡入淡出[问题].html
- 缓冲运动-2-多个div淡入淡出[解决].html
- JavaScript 高级课程之缓冲/多个DIV运动框架
- JavaScript 高级课程之缓冲+多个DIV运动框架实现 + 透明度
- JavaScript 动画之多个div同时变宽
- js改变宽高字体大小透明度多物体模块运动
- js改变宽高字体大小透明度多物体模块运动
- 缓冲运动
- 缓冲运动
- JavaScript 高级课程之缓冲收缩(多个DIV),谈入谈出
- 缓冲运动 //缓冲运动 (目标值
- 使用Construct 2制作HTML5游戏——完善
- 理解 Java 序列化
- 机器学习: Logistic Regression--python
- Hadoop/MapReduce 及 Spark KMeans聚类算法实现
- Codeforces Round #446 (Div. 2) B. Wrath(线段树,RMQ,区间最值)
- 多个div 缓冲运动—变宽
- 干货:FLAG的风头过后,哪一家才是最好的公司?
- iOS开发-测量APP启动耗时
- Google Play Service中安全检测API的使用说明
- 感恩节到来,还在找一个和家人聚聚朋友叙叙的地方吗?
- daterangepick时间控件双日历设置时分秒
- 数据结构线性表顺序存储C++实现
- SDUT-3378&&SDUT2040
- 格式化输出(常量练习)