RT,是参照慕课的教程做的。两个多小时的教程,看完了然后晚上的时候做了下,看的时候感觉明白了,但其实做的时候还是有很多小细节需要处理的。
上代码,思想什么的直接去慕课看教程就好了。点击这里
注释也比较清楚,应该能看得懂
-------16年12.5更新-------
想做全屏滚动,发现这个框架不支持,于是做了点小改动,支持document.body的scrollTop属性还有其他部分宽高属可自行测试,顺带修复了一部分小bug
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title> </title> 6 7 <style> 8 #aaa{ 9 position:absolute; 10 left:-50px; 11 width: 100px; 12 height: 100px; 13 background-color: blue; 14 border:1px solid red; 15 } 16 #ddd{ 17 position:absolute; 18 top:120px; 19 left:-50px; 20 width: 100px; 21 height: 100px; 22 background-color: red; 23 filter: alpha(opacity:30); 24 opacity: 0.3; 25 } 26 </style> 27 </head> 28 <body> 29 <div id = "aaa">123</div> 30 </body> 31 <script type="text/javascript" src="./js/animate.js"></script> 32 <script type="text/javascript"> 33 window.onload=function(){ 34 var aaa = document.getElementById('aaa'); 35 var ddd = document.getElementById('ddd'); 36 37 aaa.onmouseover=function(){ 38 showAnimate(this,{'width':200,'height':200}); 39 } 40 aaa.onmouseout=function(){ 41 showAnimate(this,{'width':100,'height':100}); 42 } 43 } 44 </script> 45 </html>