<<  < 2011 - >  >>
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28
 

最 新 评 论

最 新 日 志

最 新 留 言

搜 索

用 户 登 录

博 客 相 册

我 的 圈 子

我 的 好 友

友 情 连 接


 
 
一圈旋转的文字跟着鼠标移动
[ 2007-2-20 21:48:00 | By: 『娱乐圈→技术讨论中心』 ]
 
今天再告诉大家让一圈旋转的文字跟着鼠标移动,打开文章就能看到效果了,方法也是把这段代码加入到模板的Body。
<SCRIPT language=JavaScript>
if (document.all) {
yourLogo = "欢迎光临懋庭的雪、梅花园 ";
logoFont = "宋体";
logoColor = "#217cff";
yourLogo = yourLogo.split('');
L = yourLogo.length;
TrigSplit = 360 / L;
Sz = new Array()
logoWidth = 100;
logoHeight = -30;
ypos = 0;
xpos = 0;
step = 0.03;
currStep = 0;
document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < L; i++) {
document.write('<div id="ie" style="position:absolute;top:0px;left:0px;'
+'width:10px;height:10px;font-family:'+logoFont+';font-size:12px;'
+'color:'+logoColor+';text-align:center">'+yourLogo[i]+'</div>');
}
document.write('</div></div>');
function Mouse() {
ypos = event.y;
xpos = event.x - 5;
}
document.onmousemove=Mouse;
function animateLogo() {
outer.style.pixelTop = document.body.scrollTop;
for (i = 0; i < L; i++) {
ie[i].style.top = ypos + logoHeight * Math.sin(currStep + i * TrigSplit * Math.PI / 180);
ie[i].style.left = xpos + logoWidth * Math.cos(currStep + i * TrigSplit * Math.PI / 180);
Sz[i] = ie[i].style.pixelTop - ypos;
if (Sz[i] < 5) Sz[i] = 5;
ie[i].style.fontSize = Sz[i] / 1.7;
}
currStep -= step;
setTimeout('animateLogo()', 20);
}
window.onload = animateLogo;
}
</SCRIPT
>
 
 
 
Re:一圈旋转的文字跟着鼠标移动
[ 2008-11-11 14:25:00 | By: 访客1iy3CO(游客) ]
 
访客1iy3CO(游客)hhghhgf
 
个人主页 | 引用 | 返回 | 删除 | 回复
 
发表评论:
天涯博客
天涯博客欢迎您!