この記事では、JS+CSSによる中心的な背景半透明Div層を飛び出す方法について説明します。参照のためにそれを共有してください。特定の実装方法は次のとおりです。
次のようにコードをコピーします。<
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<Meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<Title> JS+CSSは、中心的な背景半透明div層をポップアップします</title>
<style type = "text/css">
ボディ{マージン:0px;}
#bg {width:100%; height:100%; top:0px; left:0px; position:absolute; filter:alpha(opacity = 50); ofacity:0.5;背景:#000000;ディスプレイ:なし;}
#popbox {position:absolute; width:400px;高さ:400px;左:50%;トップ:50%;マージン:-200px 0 0 -200px;表示:なし;背景:#666666;}
</style>
<script type = "text/javascript">
function pupopen(){
document.getElementById( "bg")。style.display = "block";
document.getElementById( "Popbox")。style.display = "block";
}
関数upclose(){
document.getElementById( "bg")。style.display = "none";
document.getElementById( "Popbox")。style.display = "none";
}
</script>
</head>
<body>
</br>
CSSポップアップレイヤー、またはポップアップウィンドウには、半透明のバックグラウンドポップアップボックスがあり、Webサイトのログイン、ユーザー登録、アナウンスプロンプトに非常に適しています。 </br>すなわち、opは両方とも両方〜ポップアップウィンドウ、背景は半透明です</br>
原則:2つのレイヤー、1つは100%の高さと幅があり、もう1つはポップアップするウィンドウの特定のコンテンツです。非私の使用で不透明度:0.60;
</br> </br> <a href = "#" onclick = "pupopen()">ここをクリックしてウィンドウを開きます</a>
<div id = "bg"> </div>
<div id = "popbox"> 2つのレイヤー、1つは100%の高さと幅があり、もう1つはポップアップするウィンドウの特定のコンテンツです。半透明はIEで使用されます:フィルター:アルファ(不透明= 60);非私の使用で不透明度:0.60;
<br>
<br>
<br>
<a href = "#" onclick = "pupclose()">クリックしてウィンドウを閉じます</a>
</div>
</body>
</html>
この記事がみんなのJavaScriptプログラミングに役立つことを願っています。