標籤:col flow pointer .com element logs tom str console
1、arguments對象
alert(arguments.length);//返回實參的個數
只在函數內使用
arguments.callee;//返回正在執行的函數,也是在函數體內使用
在函數遞迴調用時,推薦使用arguments.callee代替函數名本身
function fn(){console.log(arguments.callee);}
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>小米手機展示</title> 6 <style> 7 .xiaomi{ 8 width: 512px; 9 height: 400px;10 border: 1px solid #c1c1c1;11 margin: 100px auto;12 overflow: hidden;13 position: relative;14 }15 .xiaomi span{16 width: 100%;17 height: 200px;18 position: absolute;19 left:0;20 cursor: pointer;21 }22 .up{23 top:0;24 }25 .down{26 bottom:0;27 }28 #pic{29 position: absolute;30 top:0;31 left:0;32 }33 </style>34 </head>35 <body>36 <div class="xiaomi">37 <img src="mi.png" alt="" id="pic">38 <span class="up" id="picUp"></span>39 <span class="down" id="picDown"></span>40 </div>41 42 </body>43 <script>44 function $(id){return document.getElementById(id);}45 var num=0;//控制top值46 var timer=null;
//上移47 $("picUp").onmouseover=function(){48 clearInterval(timer);49 timer=setInterval(function(){50 num-=3;51 num>=-1070?$("pic").style.top = num + "px":clearInterval(timer);52 },30);53 }
//下移54 $("picDown").onmouseover=function(){55 clearInterval(timer);56 timer=setInterval(function(){57 num++;58 num<0?$("pic").style.top = num + "px":clearInterval(timer);59 60 },10)61 }62 63 $("pic").parentNode.onmouseout=function(){64 clearInterval(timer);65 }66 </script>67 </html>
運行效果:
第37天:小米手機圖片展示