js百叶窗效果网页特效代码

发布时间:2020-07-09编辑:脚本学堂
一例js网页百叶窗特效代码,用js脚本实现的百叶窗效果,由上到下交叉切换的网页特效,百叶窗关闭与展开效果,代码很简单也很实用,一起来了解下。

例子,js百叶窗效果网页特效代码
 

复制代码 代码示例:
<html>
<head>
<title>网页百叶窗特效代码 - www.jb200.com</title>
<style>
<!--
.intro{position:absolute;
left:0;
top:0;
layer-background-color:green;
background-color:green;
border:0.1px solid green
}
-->
</style>
</head>
<body>
<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>
</body>
</html>