QaQlinks / Html 实例 / html实例Iframe with Overlay 131 个条目

html实例Iframe with Overlay

Html 实例 #122 更新 2024-08-31

在 iframe 上方盖一层遮罩,6 秒后自动淡出,把下面的内容露出来。常用于演示页、推广页遮住首屏加载过程,避免 iframe 还没加载完就露出白屏;时长和淡出效果都可以按需要调整。

html实例Iframe with Overlay


<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Iframe with Overlay</title>
    <style>
        body {
            margin: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #f0f0f0;
        }

        .iframe-container {
            position: relative;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        iframe {
            width: 100%;
            height: 100%;
            border: none;
        }

        .overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
            opacity: 1;
            transition: opacity 1s ease; /* 渐变效果 */
        }
    </style>
</head>
<body>

<div class="iframe-container">
    <iframe src="https://www.qaqlinks.com" title="Iframe Example"></iframe>
    <div class="overlay" id="overlay"></div>
</div>

<script>
    // 6秒后淡隐overlay
    setTimeout(() => {
        const overlay = document.getElementById('overlay');
        overlay.style.opacity = '0';
    }, 10000);
</script>

</body>
</html>

点击统计

最近 30 天 · 单日最高 3 · 数据刚开始累积
3总点击
0今日
3近 7 天
0.1日均
012311-26 · 3 次10-2911-0511-1311-20今天

评论

0

还没有评论,来说两句。

发表评论

邮箱不会被公开。带 * 的为必填项。

记录信息

分类
Html 实例
类型
HTML 实例
使用
完整说明在原站详情页,可以前往查看
更新
2024-08-31
点击
3 次
编号
#122