ホームページ  >  記事  >  ウェブフロントエンド  >  Webページのウィンドウを途中から上下に拡大するjsの実装方法_javascriptスキル

Webページのウィンドウを途中から上下に拡大するjsの実装方法_javascriptスキル

WBOY
WBOYオリジナル
2016-05-16 16:11:531099ブラウズ

この記事の例では、jsを使用してWebページのウィンドウを中央から上下に拡大する方法を説明しています。皆さんの参考に共有してください。具体的な分析は次のとおりです。

これは、途中から徐々に上下に広がるページ表示エフェクトです。 コードは次のとおりです。

コードをコピー コードは次のとおりです:

<頭>
js は中央の展開された Web ウィンドウから表示されます
<スタイル>





<スクリプト言語="JavaScript1.2">
var 速度=20
var temp=新しい配列()
var temp2=新しい配列()
if (document.layers){
for (i=1;i temp[i]=eval("document.i" i ".clip")
temp2[i]=eval("document.i" i)
temp[i].width=window.innerWidth
temp[i].height=window.innerHeight/2
temp2[i].top=(i-1)*temp[i].height
}
}
else if (document.all){
var Clipbottom=document.body.offsetHeight/2,cliptop=0
for (i=1;i temp[i]=eval("document.all.i" i ".style")
temp[i].width=document.body.clientWidth
temp[i].height=document.body.offsetHeight/2
temp[i].top=(i-1)*parseInt(temp[i].height)
}
}
関数 openit(){
window.scrollTo(0,0)
if (document.layers){
temp[1].bottom-=speed
temp[2].top =速度
if (temp[1].bottom clearInterval(stopit)
}
else if (document.all){
クリップボトム-=速度
temp[1].clip="rect(0 auto "clipbottom" 0)"
クリップトップ = スピード
temp[2].clip="rect(" クリップトップ " 自動自動)"
if (clipbottom clearInterval(stopit)
}
}
関数 gogo(){
stopit=setInterval("openit()",100)
}
ゴゴ()


この記事が皆さんの Go 言語プログラミングに役立つことを願っています。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。