Imitation Apple Computer taskbar menu

From , 2 Years ago, written in JavaScript, viewed 77 times.
URL https://pastebin.vip/view/12092a75
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>仿苹果电脑任务栏菜单</title>
  6. <style type="text/css">
  7. body {
  8.         margin:0;
  9.         padding:0
  10. }
  11. #menu {
  12.         position:absolute;
  13.         width:100%;
  14.         bottom:0;
  15.         text-align:center;
  16. }
  17. </style>
  18. <script type="text/javascript">
  19. window.onload = function ()
  20. {
  21.         var oMenu = document.getElementById("menu");
  22.         var aImg = oMenu.getElementsByTagName("img");
  23.         var aWidth = [];
  24.         var i = 0;
  25.         //保存原宽度, 并设置当前宽度
  26.         for (i = 0; i < aImg.length; i++)
  27.         {
  28.                 aWidth.push(aImg[i].offsetWidth);
  29.                 aImg[i].width = parseInt(aImg[i].offsetWidth / 2);
  30.         }
  31.         //鼠标移动事件
  32.         document.onmousemove = function (event)
  33.         {
  34.                 var event = event || window.event;
  35.                 for (i = 0; i < aImg.length; i++)
  36.                 {
  37.                         var a = event.clientX - aImg[i].offsetLeft - aImg[i].offsetWidth / 2;
  38.                         var b = event.clientY - aImg[i].offsetTop - oMenu.offsetTop - aImg[i].offsetHeight / 2;
  39.                         var iScale = 1 - Math.sqrt(a * a + b * b) / 300;
  40.                         if (iScale < 0.5) iScale = 0.5;
  41.                         aImg[i].width = aWidth[i] * iScale
  42.                 }
  43.         };
  44. };
  45. </script>
  46. </head>
  47. <body>
  48. <div id="menu"> <img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /><img src="http://yuncode.net/upload/headicon/default.jpg" /></div>
  49. </body>
  50. </html>
  51.  

Reply to "Imitation Apple Computer taskbar menu"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website