首页 新闻 搜索 短信 分类 聊天 企业
上移动梦网
赢手机大奖

新浪首页 > 科技时代 > 网上学园 > 主页制作 > 正文
为您的个人主页设计开幕动画

http://www.sina.com.cn 2002/04/15 11:55 赛迪网

  文/洪宝光

  每当看到一个好的动画时,我都会想着为自己主页设置一个开幕画面。效果是有一段动画以后再进入主页,这样感觉是不是很爽啊!设计很简单,大家可要好好地看呀!

  一、<body></body>添加如下代码:

  <style>
.intro{position:absolute;
left:0;
top:0;
layer-background-color:#e
8eee8;
background-color:#e8eee8;
border:0.1px solid #e8eee8
}
</style>

  二、设置一个图层,名字是i1。然后编辑代码,代码添加如图1所示:

  <div id="i1" class="intro"></div><div id="i2" class="intro"></div><div id="i3"
class="intro"></div><div id="i4" class="intro"></div><div id="i5" class="intro"></div><div
id="i6" class="intro"></div><div id="i7" class="intro"></div><div id="i8" class="intro"></div>
<SCRIPT language=javascript>
var speed=30
var temp=new Array()
var temp2=new Array()
if (document.layers){
for (i=1;i<=8;i++){
temp[i]=eval("document.i"+i+".clip")
temp2[i]=eval("document.i"+i)
temp[i].width=window.innerWidth/8-0.3
temp[i].height=window.innerHeight
temp2[i].left=(i-1)*temp[i].width
}
}
else if (document.all){
var clipbottom=document.body.offsetHeight,cliptop=0
for (i=1;i<=8;i++){
temp[i]=eval("document.all.i"+i+".style")
temp[i].width=document.body.clientWidth/8
temp[i].height=document.body.offsetHeight
temp[i].left=(i-1)*parseInt(temp[i].width)
}
}
function openit(){
window.scrollTo(0,0)
if (document.layers){
for (i=1;i<=8;i=i+2)
temp[i].bottom-=speed
for (i=2;i<=8;i=i+2)
temp[i].top+=speed
if (temp[2].top>window.innerHeight)
clearInterval(stopit)
}
else if (document.all){
clipbottom-=speed
for (i=1;i<=8;i=i+2){
temp[i].clip="rect(0 auto+"+clipbottom+" 0)"
}
cliptop+=speed
for (i=2;i<=8;i=i+2){
temp[i].clip="rect("+cliptop+" auto auto)"
}
if (clipbottom<=0)
clearInterval(stopit)
}
}
function gogo(){
stopit=setInterval("openit()",100)
}
gogo()
</SCRIPT>


图1


  


发表评论】【初学者园地】【科技聊天】【关闭窗口

新 闻 查 询

 相关链接
【学园专题】主页制作步步高
用CSS实现鼠标单击特殊效果图(2002/04/12 10:10)
为Word 2000生成的Web页“减肥”(2002/03/29 11:11)
实现网页制作中“层”精确定位的绝招(2002/03/22 17:20)
主页特效尝鲜--你被气泡跟踪了!(2002/03/22 17:11)
轻松弹出无边框网页的Javscrpt代码(2002/03/15 13:52)
给你的个人主页加上彩色的边框(2002/03/07 13:52)
网站制作更轻松:Adobe Illustrator(2002/03/01 10:15)
既生瑜 何生亮:Adobe LiveMotion(2002/02/28 13:57)


科技时代意见反馈留言板 电话:010-82612286 或 010-82628888-3488   欢迎批评指正

网站简介 | 用户注册 | 广告服务 | 招聘信息 | 中文阅读 | Richwin | 联系方式 | 帮助信息

Copyright © 1996 - 2002 SINA.com, Stone Rich Sight. All Rights Reserved

版权所有 四通利方 新浪网