国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

js實現橫向百葉窗效果網頁切換動畫效果的方法

2019-11-20 13:03:40
字體:
來源:轉載
供稿:網友

本文實例講述了js實現橫向百葉窗效果網頁切換動畫效果的方法。分享給大家供大家參考。具體分析如下:

這是一款很簡潔但是效果卻不錯的網頁切換效果,點擊新網頁后,網頁會出現藍白相間的百葉窗線條自動切換,直到網頁全部顯示完全。代碼如下:

復制代碼 代碼如下:
<html>
<head>
<title>js網頁百葉窗動態切換效果</title>
<style>
<!--
.intro{
position:absolute;
left:0;
top:0;
layer-background-color:blue;
background-color:blue;
border:0.1px solid blue
}
-->
</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="JavaScript1.2">
var speed=20
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
temp[i].height=window.innerHeight/8
temp2[i].top=(i-1)*temp[i].height
}
}
else if (document.all){
var clipright=document.body.clientWidth,clipleft=0
for (i=1;i<=8;i++){
temp[i]=eval("document.all.i"+i+".style")
temp[i].width=document.body.clientWidth
temp[i].height=document.body.offsetHeight/8
temp[i].top=(i-1)*parseInt(temp[i].height)
}
}
function openit(){
window.scrollTo(0,0)
if (document.layers){
for (i=1;i<=8;i=i+2)
temp[i].right-=speed
for (i=2;i<=8;i=i+2)
temp[i].left+=speed
if (temp[2].left>window.innerWidth)
clearInterval(stopit)
}
else if (document.all){
clipright-=speed
for (i=1;i<=8;i=i+2){
temp[i].clip="rect(0 "+clipright+" auto 0)"
}
clipleft+=speed
for (i=2;i<=8;i=i+2){
temp[i].clip="rect(0 auto auto "+clipleft+")"
}
if (clipright<=0)
clearInterval(stopit)
}
}
function gogo(){
stopit=setInterval("openit()",100)
}
gogo()
</script>
</body>
</html>

希望本文所述對大家的javascript程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 仁化县| 南川市| 华安县| 胶州市| 五常市| 大余县| 蒙阴县| 乡宁县| 新余市| 西乌珠穆沁旗| 大厂| 临高县| 乡宁县| 新沂市| 区。| 略阳县| 依兰县| 龙井市| 大厂| 噶尔县| 攀枝花市| 增城市| 蓬安县| 驻马店市| 镇江市| 定结县| 台州市| 连云港市| 碌曲县| 东安县| 兰州市| 巴林右旗| 崇左市| 尤溪县| 普陀区| 萍乡市| 南部县| 衡阳市| 乌拉特前旗| 镇坪县| 衢州市|