發現了一個背景色線性變化的網頁,果斷保存一下源代碼

網頁效果

 

網頁源代碼:

<!DOCTYPE html>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>正在跳轉</title>
  <style>
    body {
      width: 100vw;
      height: 100vh;
      color: #fff;
      margin: 0;
      background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
      background-size: 400% 400%;
      -webkit-animation: Gradient 10s ease infinite;
      -moz-animation: Gradient 10s ease infinite;
      animation: Gradient 10s ease infinite;
      overflow: hidden;
    }

    @-webkit-keyframes Gradient {
      0% {
        background-position: 0% 50%
      }
      50% {
        background-position: 100% 50%
      }
      100% {
        background-position: 0% 50%
      }
    }

    @-moz-keyframes Gradient {
      0% {
        background-position: 0% 50%
      }
      50% {
        background-position: 100% 50%
      }
      100% {
        background-position: 0% 50%
      }
    }

    @keyframes Gradient {
      0% {
        background-position: 0% 50%
      }
      50% {
        background-position: 100% 50%
      }
      100% {
        background-position: 0% 50%
      }
    }

    h1 {
      font-size: 3.2vh;
      font-weight: 300;
      text-align: center;
      position: absolute;
      top: 42%;
      right: 0;
      left: 0;
      margin: 0;
      padding: 0;
    }

    h1::after {
      position: absolute;
    }

    h1.stage1::after {
      content: '.';
    }

    h1.stage2::after {
      content: '..';
    }

    h1.stage3::after {
      content: '...';
    }

    h1.stage4::after {
      content: '....';
    }

    h1.stage5::after {
      content: '.....';
    }

    h1.stage6::after {
      content: '......';
    }

    .goto {
      cursor: pointer;
      display: inline-block;
      width: 15vh;
      color: #eee;
      font-size: 2.2vh;
      font-weight: 500;
      text-align: center;
      position: absolute;
      bottom: 10px;
      left: 0;
      right: 0;
      margin: 0 auto;
      padding: 1.9vh;
      text-decoration: underline;
    }
  </style>
</head>
<body>
  <h1 class="stage1">正在跳轉</h1>
  <span class="goto">奇怪的地方</span>
  <script>
    (function () {
      var link = getQueryString('link') || ~~(Math.random() * 100);
      var homepage = 'http://a.topurl.cn/future/?from=short_url&link=' + link + '#/more';
      var timer = null;
      var stage = 1;
      var h1 = document.querySelector('h1');

      document.querySelector('.goto').onclick = function () {
        clearTimeout(timer);
        timer = null;
        location.href = homepage;
      }

      if(!timer) {
        setInterval(function () {
          stage = stage >=6 ? 1 : stage+1;
          h1.className = 'stage'+stage;
        }, 650);
        timer = setTimeout(function () {
          var url = getQueryString('url');
          try {
            url = window.atob(url);
          } catch (e){
            url = '';
          }
          url = decodeURI(url) || homepage;
          location.href = url;
        }, 4000);
      }
    })();

    function getQueryString (name) {
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
      var split = window.location.href.split('?');
      var len = split.length;
      if (len == 1) {
        return '';
      }
      var r = split[len - 1].match(reg);
      if (r != null) {
        return decodeURIComponent(r[2]).split('#')[0];
      }
      return '';
    }
  </script>
</body>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章