美文网首页
年会抽奖效果

年会抽奖效果

作者: AcessCors | 来源:发表于2019-09-25 10:39 被阅读0次
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>随机</title>
  <!-- 在375px设备下1rem = 10px -->
  <style>
    html, body {
      font-size: 0.26vw;
      height: 100%;
      margin: 0;
      padding: 0;
    }
    .app {
      font-size: 20px;
      height: 4rem;
      text-align:center;
      color: #ff0000;
      width: 20rem;
      font-weight: 800;
    }
    .root {
      color: #fff;
      background-color: #1890FF;
      border-color: #1890FF;
      text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
      box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
      line-height: 1.6;
      padding: 4px 15px;
      position: relative;
      display: inline-block;
      font-weight: 400;
      white-space: nowrap;
      text-align: center;
      background-image: none;
      border: 1px solid transparent;
      font-size: 14px;
      border-radius: 4px;
    }
    .root:active {
      outline: 0;
      color: #fff;
      background-color: #096dd9;
      border-color: #096dd9;
    }
    .root:focus {
      outline: 0;
      color: #fff;
      background-color: #40a9ff;
      border-color: #40a9ff;
    }
  </style>
</head>

<body>
  <div style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center">
    <div>
    <div class="app" id="app"></div>
    <div style="text-align:center"><button class="root" id="root" onClick="random(1000)">开始</button></div>
    </div>
  </div>
  <script>
    document.getElementById('root').innerHTML = "开始";
    let count = false;
    let interVal = null;
    function random(num){
      count = !count;
      if (count) {
        interVal = setInterval(function(){ romdomArray(num) }, 100);
        document.getElementById('root').innerHTML = "暂停";
      } else {
        document.getElementById('root').innerHTML = "开始";
        clearInterval(interVal)
      }
    }
    function romdomArray(num){
      let array = [];
      for (let i = 0; array.length < 5; i+=1) {
        if (i===0) {
          let rondomNumber = Math.round(Math.random()* num);
          if (rondomNumber !== 0) {
            array.push(Math.round(Math.random()* num));
          } 
        } else {
          let rondomNumber = Math.round(Math.random()* num);
          if (array.indexOf(rondomNumber) === -1 && rondomNumber !== 0) {
            array.push(rondomNumber);
          }
        }
      }
      document.getElementById('app').innerHTML = array.join(' ');
    }
  </script>
</body>
</html>

相关文章

  • 年会抽奖效果

  • 年会抽奖

    离公司不远,分别坐车,抵达就餐地点。一进门,红色的抽奖箱,卡哇伊的抽奖牌,可不知道为啥签到时非得把自己拿到的抽奖号...

  • 年会抽奖

    咱公司就是这样,开个年会也有乐趣。这不,快过年了,Boss发话了:为了酬劳大家一年的辛勤付出,下周要举行年会(...

  • 年会抽奖

    微演讲打卡练习第171天,每天一分钟,成为最美好的自己 接近年底,事务繁杂,年会颇多,人脉圈越广泛,出席年会...

  • Express + Three.js 抽奖程序

    抽奖程序 年会抽奖程序,3D 球体抽奖,支持奖品信息配置,参与抽奖人员信息Excel导入,抽奖结果Excel导出 ...

  • iOS 抽奖轮盘效果实现思路

    iOS 抽奖轮盘效果实现思路 iOS 抽奖轮盘效果实现思路

  • 抽奖程序-kenxiong / lottery

    一. 概述 年底了,又到年会时间,年会肯定少不了抽奖环节,一般公司用的抽奖程序界面都是非常简陋,我在github发...

  • 你想要的抽奖开源项目都在这里

    抽奖软件是年会、活动及大型展会的必备软件之一,用于抽取奖励、调节活动气氛。不过小编最近不开森,因为年会抽奖居然连个...

  • 抽奖和AA收款,2个年会聚餐必备微信群小程序

    年关将至,一碗梁粉相信你一定会参加各种公司年会,朋友聚餐。 年会也好,聚餐也好,少不了抽奖和AA收款。 抽奖,和A...

  • 抽奖

    一年一度的年会抽奖活动开始了,因特殊情况,今年就在公司以部门形式开展年会抽奖活动! 市场销售部举办“砸...

网友评论

      本文标题:年会抽奖效果

      本文链接:https://www.haomeiwen.com/subject/kmpiuctx.html