GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 仿苹果导航菜单 · 2017code/javaScript@ed2c93f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • 仿苹果导航菜单
    • 1.html
    • images
      • 1.png
      • 2.png
      • 3.png
      • 4.png
      • 5.png
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎仿苹果导航菜单/1.html‎

Copy file name to clipboard
+64Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title></title>
5+
<style type="text/css">
6+
body{
7+
margin:0;
8+
padding:0
9+
}
10+
/*这一层是自己添加的,源代码是直接menu为最外层,但是这样不利于布局*/
11+
#box{
12+
width:100%;
13+
height: 200px;
14+
position: relative;
15+
}
16+
#menu{
17+
position:absolute;
18+
width:100%;
19+
min-width: 1000px;
20+
bottom:0;
21+
text-align:center;
22+
}
23+
</style>
24+
</head>
25+
<body>
26+
<div id="box">
27+
<div id="menu">
28+
<img src="images/1.png" />
29+
<img src="images/2.png" />
30+
<img src="images/3.png" />
31+
<img src="images/4.png" />
32+
<img src="images/5.png" />
33+
</div>
34+
</div>
35+
</body>
36+
<script type="text/javascript">
37+
window.onload = function ()
38+
{
39+
var oMenu = document.getElementById("menu");
40+
var aImg = oMenu.getElementsByTagName("img");
41+
var aWidth = [];
42+
var i = 0;
43+
//保存原宽度, 并设置当前宽度
44+
for (i = 0; i < aImg.length; i++)
45+
{
46+
aWidth.push(aImg[i].offsetWidth); //当前图片为128px乘128px
47+
aImg[i].width = parseInt(aImg[i].offsetWidth / 2) ; //为每一张图片设置新宽度,为原宽度/2
48+
}
49+
//鼠标移动事件
50+
oMenu.onmousemove = function (event)
51+
{
52+
var EVENT = event || window.event;
53+
for (i = 0; i < aImg.length; i++)
54+
{
55+
var a = EVENT.clientX - aImg[i].offsetLeft - aImg[i].offsetWidth / 2;
56+
var b = EVENT.clientY - aImg[i].offsetTop - oMenu.offsetTop - aImg[i].offsetHeight / 2;
57+
var iScale = 1 - Math.sqrt(a * a + b * b) / 300;
58+
if (iScale < 0.5) iScale = 0.5;
59+
aImg[i].width = aWidth[i] * iScale;
60+
}
61+
};
62+
};
63+
</script>
64+
</html>
Collapse file

‎仿苹果导航菜单/images/1.png‎

Copy file name to clipboard
29.8 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎仿苹果导航菜单/images/2.png‎

Copy file name to clipboard
15.6 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎仿苹果导航菜单/images/3.png‎

Copy file name to clipboard
19.1 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎仿苹果导航菜单/images/4.png‎

Copy file name to clipboard
9.61 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎仿苹果导航菜单/images/5.png‎

Copy file name to clipboard
15 KB
  • Display the source diff
  • Display the rich diff
Loading

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.