第37天:小米手機圖片展示

來源:互聯網
上載者:User

標籤: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天:小米手機圖片展示

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.