4月2日

刷新跳转

page1.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>page 1</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            font-size: 2vmin;
        }

        div {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100vh;
            background-color: #171717;
        }

        .title {
            font-family: sans-serif;
            font-size: 10rem;
            color: #17f700;
            font-weight: 900;
            cursor: pointer;
        }

        .title span {
            font-size: 10rem;
            color: #f7f7f7;
        }

        .loading {
            position: fixed;
            flex-direction: column;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background-color: #f7f7f7;
            z-index: 100000000;
            transition: 1s ease;
        }

        .loading svg {
            width: 5rem;
            margin-bottom: 2rem;
            overflow: visible;
            transition: 0.3s ease;
        }

        .loading svg circle {
            fill: none;
            stroke: #171717;
            stroke-width: 12;
            stroke-dasharray: 160;
            stroke-dashoffset: 160;
            transform-origin: center;
            animation: circle_rotate 3s ease-in infinite;
        }

        @keyframes circle_rotate {
            0% {
                transform: rotate(0deg);
                stroke-dashoffset: 160;
            }

            100% {
                transform: rotate(360deg);
                stroke-dashoffset: -160;
            }
        }

        .loading p {
            font-family: sans-serif;
            font-size: 2rem;
            color: #171717;
            font-weight: 900;
            transition: 0.3s ease;
        }

        .loading_out {
            transform: translateY(100%);
        }

        .loading_out svg,
        .loading_out p {
            opacity: 0;
        }

    </style>
</head>

<body>
    <div class="loading">
        <svg viewbox='0 0 50 50'>
            <circle r='25' cx='25' cy='25'></circle>
        </svg>
        <p>LOADING</p>
    </div>
    <p onclick="loading.in('./page2.html')" class="title">PAGE <span>1</span>
    </p>
</body>
<script>
    // JIEJOE produce
    // b站主页:https://space.bilibili.com/3546390319860710
    const loading = {
        container: document.querySelector(".loading"),
        in(target) {
            this.container.classList.remove("loading_out");
            setTimeout(() => {
                window.location.href = target;
            }, 1000)
        },
        out() {
            this.container.classList.add("loading_out");
        }
    };
    window.addEventListener("load", () => {
        loading.out();
    })
</script>

</html>

page2.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>page 2</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            font-size: 2vmin;
        }

        div {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100vh;
            background-color: #17f700;
        }

        .title {
            font-family: sans-serif;
            font-size: 10rem;
            color: #171717;
            font-weight: 900;
            cursor: pointer;
        }

        .title span {
            font-size: 10rem;
            color: #f7f7f7;
        }

        .loading {
            position: fixed;
            flex-direction: column;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background-color: #f7f7f7;
            z-index: 100000000;
            transition: 1s ease;
        }

        .loading svg {
            width: 5rem;
            margin-bottom: 2rem;
            overflow: visible;
            transition: 0.3s ease;
        }

        .loading svg circle {
            fill: none;
            stroke: #171717;
            stroke-width: 12;
            stroke-dasharray: 160;
            stroke-dashoffset: 160;
            transform-origin: center;
            animation: circle_rotate 3s ease-in infinite;
        }

        @keyframes circle_rotate {
            0% {
                transform: rotate(0deg);
                stroke-dashoffset: 160;
            }

            100% {
                transform: rotate(360deg);
                stroke-dashoffset: -160;
            }
        }

        .loading p {
            font-family: sans-serif;
            font-size: 2rem;
            color: #171717;
            font-weight: 900;
            transition: 0.3s ease;
        }

        .loading_out {
            transform: translateY(100%);
        }

        .loading_out svg,
        .loading_out p {
            opacity: 0;
        }

    </style>
</head>

<body>
    <div class="loading">
        <svg viewbox='0 0 50 50'>
            <circle r='25' cx='25' cy='25'></circle>
        </svg>
        <p>LOADING</p>
    </div>
    <p onclick="loading.in('./page1.html')" class="title">PAGE <span>2</span>
    </p>
</body>
<script>
    // JIEJOE produce
    // b站主页:https://space.bilibili.com/3546390319860710
    const loading = {
        container: document.querySelector(".loading"),
        in(target) {
            this.container.classList.remove("loading_out");
            setTimeout(() => {
                window.location.href = target;
            }, 1000)
        },
        out() {
            this.container.classList.add("loading_out");
        }
    };
    window.addEventListener("load", () => {
        loading.out();
    })
</script>

</html>

 

posted @ 2025-04-03 08:01  KuanDong24  阅读(13)  评论(0)    收藏  举报