弹窗内嵌入iframe并去除边框的完整解决方案
<!DOCTYPE html>
<html>
<head>
<style>
/* 弹窗样式 */
.popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999;
}
<p>.popup-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
padding: 20px;
border-radius: 5px;
}</p>
<p>/* 文字点击样式 */
.clickable-text {
cursor: pointer;
text-decoration: underline;
}</p>
<p>.popup-content iframe {
border: none;
}</p>
<p>.iframe-full {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style></p>
</head>
<body>
<p>点击下面的文字弹出弹窗:</p>
<p class="clickable-text" onclick="showPopup()">点击弹窗</p>
<div id="popup" class="popup">
<div class="popup-content">
<h2>这是一个弹窗</h2>
<p>这是弹窗的内容。</p>
<iframe class="iframe-full" src="手机/index.html" width="100%" height="100%"></iframe>
<button onclick="hidePopup()">关闭弹窗</button>
</div>
</div>
<script>
function showPopup() {
document.getElementById("popup").style.display = "block";
}
function hidePopup() {
document.getElementById("popup").style.display = "none";
}
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/lZT5 著作权归作者所有。请勿转载和采集!