超Cool效果,讓你的鏈接象風(fēng)車一樣旋轉(zhuǎn)。要完成此效果需要兩個(gè)步驟。
第一步:把如下代碼加入到<head>區(qū)域中
<style>
.fly {
color: 336c6c;
font-family: arial;
font-size: 24px;
position: absolute;
visibility: hidden;
z-index: 2;
}
.logo {
font-family: times;
font-size: 48px;
color: blue;
position: absolute;
top: 0px;
left: 70px;
visibility: visible;
z-index: 1;
}
.desc {
text-align: center;
font-family: 楷體_GB2312;
font-size: 18px;
color: #336c6c;
position: absolute;
top: 220px;
left: 140px;
width: 400px;
visibility: hidden;
z-index: 0;
}
BODY {
background: #c0c0c0;
}
A {
color: lime;
}
A:HOVER {
color : yellow;
}
</style>
<script LANGUAGE="Javascript">
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}
function hideObject(obj) {
if (ns4) obj.visibility = "hide"
else if (ie4) obj.visibility = "hidden"
}
function slideLogo(from, to) {
if (from < to) {
company.top = (from += 10);
setTimeout(‘slideLogo(‘ + from + ‘,‘ + to + ‘)‘, 20);
}
else initObjects();
}
function rotateObjects() {
for (var i = 0; i < pos.length; i++) {
pos[i] += inc; objects[i].visibility = ‘visible‘;
objects[i].left = (r * Math.cos(pos[i])) + xoff
objects[i].top = (r * Math.sin(pos[i])) + yoff;
}
rotateTimer = setTimeout("rotateObjects()", 50);
}||| function initObjects() {
objects = new Array(fly1, fly2, fly3, fly4);
pos = new Array();
pos[0] = 0;
for (var i = 1; i < objects.length; i++) {
pos[i] = parseFloat(pos[i - 1] + ((2 * pi) / objects.length));
}
rotateObjects();
}
/* Variables for rotating objects */
var objects;
var pos;
var r = 160; // radius
var xoff = 280; // x offset
var yoff = 170; // y offset
var pi = Math.PI; // get pi
var inc = pi / 180; // degrees per rotation cycle
var objects; // objects to be rotated
var pos; // position for objects
</script>
第二步:把如下代碼加入到<body>區(qū)域中。
<div ID="fly1" CLASS="fly"><p>
<a HREF="#" onMouseOver="showObject(desc1)"
onMouseOut="hideObject(desc1)">link 1</a><br>
</p>
</div><div ID="fly2" CLASS="fly"><p>
<a HREF="#" onMouseOver="showObject(desc2)"
onMouseOut="hideObject(desc2)">link 2</a><br>
</p>
</div><div ID="fly3" CLASS="fly"><p>
<a HREF="#" onMouseOver="showObject(desc3)"
onMouseOut="hideObject(desc3)">link 3</a><br>
</p>
</div><div ID="fly4" CLASS="fly"><p>
<a HREF="#" onMouseOver="showObject(desc4)"
onMouseOut="hideObject(desc4)">link 4</a><br>
</p>
</div><div ID="company" CLASS="logo">
<p><small>WELCOME TO Typhoon Start</small></p>
</div><div ID="desc1" CLASS="desc">
<p>link 1的內(nèi)容 </p>
</div><div ID="desc2" CLASS="desc">
<p>link 2的內(nèi)容 </p>
</div><div ID="desc3" CLASS="desc">
<p>link 3的內(nèi)容 </p>
</div><div ID="desc4" CLASS="desc">
<p>link 4的內(nèi)容 </p>
</div><script LANGUAGE="Javascript">
/* Simple version detection */
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
/* They can be used in place
of hidden and visible because on occasion Navigator has problems with the two */
var HIDDEN = (isNS) ? ‘hide‘ : ‘hidden‘;
var VISIBLE = (isNS) ? ‘show‘ : ‘visible‘;
/* Create shortcut variables for different absolutely positioned elements */
var fly1 = (isNS) ? document.fly1 : document.all.fly1.style;
var fly2 = (isNS) ? document.fly2 : document.all.fly2.style;
var fly3 = (isNS) ? document.fly3 : document.all.fly3.style;
var fly4 = (isNS) ? document.fly4 : document.all.fly4.style;
var company = (isNS) ? document.company : document.all.company.style;
var desc1 = (isNS) ? document.desc1 : document.all.desc1.style;
var desc2 = (isNS) ? document.desc2 : document.all.desc2.style;
var desc3 = (isNS) ? document.desc3 : document.all.desc3.style;
var desc4 = (isNS) ? document.desc4 : document.all.desc4.style;
/* Begin the sliding of the company logo */
slideLogo(0, 140);
</script>
北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |