大家好,我正在尋找一個JS彈出響應能夠在大多數屏幕尺寸上查看。目前彈出窗口在頁面中間加載,但在縮短瀏覽器時不會調整大小?製作JS PopUp響應?
HTML:
<div class="col-lg-12">
<div id="ac-wrapper" style='display:none'>
<div id="popup">
<center>
<h2>Popup Content Here</h2>
<input type="submit" name="submit" value="Submit" onClick="PopUp('hide')" />
</center>
</div>
</div>
</div>
CSS:
#ac-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, .6);
z-index: 1001;
}
#popup {
width: 555px;
height: 375px;
background: #222;
border: 5px solid #000;
border-radius: 25px;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
box-shadow: #64686e 0px 0px 3px 3px;
-moz-box-shadow: #64686e 0px 0px 3px 3px;
-webkit-box-shadow: #64686e 0px 0px 3px 3px;
position: relative;
top: 150px;
left: 375px;
}
JS:
function PopUp(hideOrshow) {
if (hideOrshow == 'hide') document.getElementById('ac-wrapper').style.display = "none";
else document.getElementById('ac-wrapper').removeAttribute('style');
}
window.onload = function() {
setTimeout(function() {
PopUp('show');
}, 5000);
}
更新:
Here's whats happening! the popup box is still not resizing to the page dimensions
更新:
看看我的問題上的更新,它有一個最新情況的圖片?我希望完整的框能夠在屏幕最小化時進行查看。謝謝您的幫助。 – giofus
與@beerwin代碼組合了一下這個工作。感謝百萬 – giofus
在這種情況下,您可以同時提出兩個問題並接受最能幫助您的問題。 – beerwin