Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
onClick ダイアログのポップアップ ウィンドウ機能に取り組んでいます。200 x 200 px のポップアップ ウィンドウがあります。ボタンのonClickでボックスが開かれ、ボックスの背後にあるコンテンツがクリックできないようにしたいのですが、問題は、画面領域のみが無効になっているため、ページ全体をカバーしないことです&私ページ全体をカバーする必要があります。
あなたができることは、divでクリックできないようにしたい他のすべてを含めることです。body と divz-index:0;を指定し、クリックでdivz-index:-1;を指定すると、div が body の下に移動し、div 内のすべてがクリックできなくなります。
z-index:0;
z-index:-1;
CSS:
body{z-index:0;} #MainDiv{z-index:0;}
この行を関数に追加します
document.getElementById("MainDiv").style.zIndex="-1";