Html 如何使弹出框显示一旦网站被打开
嗨,伙计们。任何关于如何使弹出框在网站打开后出现的想法。当前,弹出框仅在单击后打开。一旦站点完成加载,箱子是否可能打开Html 如何使弹出框显示一旦网站被打开,html,css,popup,Html,Css,Popup,嗨,伙计们。任何关于如何使弹出框在网站打开后出现的想法。当前,弹出框仅在单击后打开。一旦站点完成加载,箱子是否可能打开 <span class="box"> <span class="title">Title</span> <span class="copy">Pellentesque habitant morbi tristique senectus et netus</span> 标题 佩伦特式居住者morbi tristiqu
<span class="box">
<span class="title">Title</span>
<span class="copy">Pellentesque habitant morbi tristique senectus et netus</span>
标题
佩伦特式居住者morbi tristique Sentecus et netus
如果您只是希望弹出窗口显示在页面加载本身上(而不是单击按钮后),请通过向标记添加checked='true',使
成为页面加载本身的默认选择
HTML:
<input type="checkbox" id="linkie" class="popUpControl" checked='true'>
window.onload = function () {
document.getElementById('linkie').checked = true;
}
|
需要了解的额外信息:
<input type="checkbox" id="linkie" class="popUpControl" checked='true'>
window.onload = function () {
document.getElementById('linkie').checked = true;
}
下面是一段CSS,它会触发您的框出现
.popUpControl:checked ~ label > .box {
opacity: 1;
-webkit-transform: scale(1) skew(0deg);
-moz-transform: scale(1) skew(0deg);
-ms-transform: scale(1) skew(0deg);
-o-transform: scale(1) skew(0deg);
}
选择器有效地向浏览器指示,当选中带有class='popUpControl
(.popUpControl
)的元素(:选中
)时,应使带有class='box'
且具有作为父元素的标签的元素可见(使用不透明度)。缩放、倾斜和不透明度一起使其显示,而在.box
上设置的转换
使其以动画/转换的方式显示。向
元素添加checked='true'
。弹出窗口是基于这样的方式打开的。检查cookie是否存在,如果它不存在,请打开弹出窗口,然后在windows中设置cookie。onload(){}函数在页面加载时使用checked='true'时,动画不会触发吗?“我的意思是,如果初始负荷不重要,那么NBD就不重要了。”腘绳肌:非常正确。但是如果需要动画,OP可以使用JS/jQuery在页面加载上设置checked='true'
,就像这样。谢谢@Harry,它成功了!:)