网页链接跳转HTML模板

40次阅读
没有评论

效果如下,带 loading 效果,div 模块自动居中,且有倒计时效果,也可手动点击跳转。

网页链接跳转 HTML 模板

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> 跳转中...</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }

        .container {
            text-align: center;
            background-color: #fff;
            padding: 40px;
            border-radius: 15px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
            width: 400px;
            max-width: 90%;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .container:hover {transform: translateY(-5px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
        }

        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #3498db;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 20px auto;
        }

        @keyframes spin {0% { transform: rotate(0deg); }
            100% {transform: rotate(360deg); }
        }

        h1 {
            font-size: 24px;
            color: #333;
            margin-bottom: 15px;
        }

        p {
            font-size: 16px;
            color: #666;
            margin: 10px 0;
        }
        a {
            color: #3498db;
            text-decoration: none;
            font-weight: bold;
        }
        a:hover {text-decoration: underline;}
        #countdown {
            font-weight: bold;
            color: #e74c3c;
        }
    </style>

    <script>
        // 设置跳转时间 单位:毫秒
         var redirectTime = 5000;
        
        // 设置跳转的目标 URL
        var targetUrl = "https://xiyo.wang";
       
        // 自动跳转函数
        setTimeout(function() {window.location.href = targetUrl;}, redirectTime);
    </script>
</head>
<body>

    <div class="container">
        <h1> 正在跳转...</h1>
        <div class="spinner"></div>
        <p> 您将在 <span id="countdown">5</span> 秒后自动跳转至目标页面。</p>
        <p> 如果未自动跳转,请点击 <a href="https://xiyo.wang"> 这里 </a>。</p>
    </div>

    <script>
        // 倒计时显示
        var countdown = document.getElementById("countdown");
        var timeLeft = redirectTime / 1000;
        var timer = setInterval(function() {
            timeLeft--;
            countdown.textContent = timeLeft;
            if (timeLeft <= 0) {clearInterval(timer);
            }
        }, 1000);
    </script>
</body>
</html>
正文完
有偿技术支持加微信
post-qrcode
 0
评论(没有评论)
验证码