转盘抽奖

简介:

这里写图片描述


<!DOCTYPE html>
<!-- saved from url=(0030)http://localhost:90/choujiang/ -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title></title>
</head>

<body>

<style> 
.box{ 
width:400px; height:400px; 
top:50%; left:50%; 
margin-left:-200px; 
margin-top:-200px;  
position:absolute; 

background:#C4C4C4;
border-radius: 200px;
box-shadow:1px 1px 20px 15px #C5BFBF;
font-family:'黑体';
font-weight:bold;
font-size:14px;}



.child{ width:198px; height:198px; float:left; border:1px #193EB3 solid; background:#DAEB33; line-height:198px; text-align:center;}
.list1 { border-radius: 199px 0px 0px 0px; border-left:1px #eee solid;border-top:1px #eee solid; line-height:230px;}
.list2 { border-radius:  0px 199px 0px 0px; border-right:1px #eee solid;border-top:1px #eee solid; line-height:230px;}
.list4 { border-radius:  0px 0px  0px 199px; border-left:1px #eee solid;border-bottom:1px #eee solid; line-height:150px;}
.list3 { border-radius:  0px 0px 199px 0px ; border-right:1px #eee solid;border-bottom:1px #eee solid; line-height:150px;}

.button{ position:absolute; width:80px; height:80px; left:50%; top:50%; margin-left:-40px; font-size:18px; border:none; font-weight:bold;
margin-top:-40px; border-radius:40px; background:#2BC73D; line-height:80px; text-align:center; cursor:pointer;}
.button:hover{box-shadow:1px 1px 20px 15px #C5BFBF;background:red;}

</style>
<!--header-->

<div class="box grad">
<div class="list">
  <div class="child list1" style="background: rgb(218, 235, 51);">一等奖:空气清新器</div>
  <div class="child list2" style="background: red;">二等奖:精美四件套</div>
  <div class="child list4" style="background: rgb(218, 235, 51);">鼓励奖:肴肉蘸醋</div>
  <div class="child list3" style="background: rgb(218, 235, 51);">三等奖:多功能足浴盆</div>

</div>
<button class="button" style="background: rgb(43, 199, 61);">抽奖</button>
</div>

<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>

<script>


$(function() {

   // 中奖概率数组
   var array1 = new Array(4,4,2,4,4,3,4,1,4);

   var cishu = 40;// 默认先转40次
   var yushu = 0; // 除4余数
   var miao = 100;// 初始转速
   var num = 0;   // 随机数 
   var count = 0; // 计数器

   $(".button").click(function(){
     $(this).attr({"disabled":"disabled"});
     $(this).css('background','#c4c4c4'); 

     yushu = 0; // 除4余数
     miao = 100;// 初始转速 
     var len = array1.length;
     var irandom = parseInt(Math.random()*len+1);
     num = cishu + array1[irandom-1];// 取1-30的随机数
     count = 0;

     setTimeout(zhuandong, 300);
     //if(array1[irandom-1] != 4)
     {
        var newarry = new Array();
        var bremove = false;
        for(var i=0;i<array1.length; i++)
        {

          if( (array1[i]!=array1[irandom-1]) || bremove)
           newarry.push(array1[i]);
          if(array1[i]==array1[irandom-1])
           bremove = true;
        }
        array1 = newarry;
     }
   });


  function zhuandong(){

    count++;
    yushu = count%4;
    if(yushu==0) 
    { 
      yushu = 4;
      if(count>30)
      { miao = miao<250?miao+50:miao;}
      else
      { miao = miao>100?miao-50:miao;}
    }

    $(".child").css('background','#DAEB33'); 
    $(".list"+yushu).css('background','red');
    num--;

    if(num<=0)
    {
       setTimeout(function(){
           alert("恭喜您喜中:"+$(".list"+yushu).html());
            $(".button").removeAttr("disabled");
            $(".button").css('background','#2BC73D'); 
         }, 500);
    }
    else{
      setTimeout(zhuandong, miao);

    }

  }


});


</script>


</body></html>
目录
相关文章
|
8月前
|
存储 安全 生物认证
苹果上架APP遇到提示缺少出口合规证明时应该如何处理-什么是APP加密文稿-优雅草卓伊凡
苹果上架APP遇到提示缺少出口合规证明时应该如何处理-什么是APP加密文稿-优雅草卓伊凡
669 62
苹果上架APP遇到提示缺少出口合规证明时应该如何处理-什么是APP加密文稿-优雅草卓伊凡
|
iOS开发 MacOS Perl
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
764 4
|
安全 API UED
WebSocket API 中的 close 事件是如何触发的?
【10月更文挑战第26天】close事件的触发涵盖了从正常的连接关闭到各种异常情况导致的连接中断等多种场景。通过监听close事件,开发人员可以在连接关闭时进行相应的处理,如清理资源、更新界面状态或尝试重新连接等,以确保应用程序的稳定性和良好的用户体验。
|
人工智能 BI
区间问题之区间覆盖(看一遍就会系列)
区间问题之区间覆盖(看一遍就会系列)
|
前端开发 JavaScript
js【详解】Promise(含 Promise 的三种状态及其变化,创建 Promise, Promise.all 语法、Promise.all 实战范例、手写 Promise.all)
js【详解】Promise(含 Promise 的三种状态及其变化,创建 Promise, Promise.all 语法、Promise.all 实战范例、手写 Promise.all)
2853 0
|
XML Java Scala
Gradle安装配置阿里云
Gradle安装配置阿里云
1520 0
|
编解码 前端开发 UED
CocosCreator 面试题(十一)Cocos Creator 屏幕适配
CocosCreator 面试题(十一)Cocos Creator 屏幕适配
837 0
|
小程序 API
微信小程序飞机大战游戏步骤及代码
微信小程序飞机大战游戏步骤及代码
1088 0
|
缓存 自然语言处理 BI
CocosCreator3.8研究笔记(二十)CocosCreator UI组件(四)
CocosCreator3.8研究笔记(二十)CocosCreator UI组件(四)
692 0
|
JavaScript 数据安全/隐私保护 Android开发
CocosCreator3.8研究笔记(十九)CocosCreator UI组件(三)(1)
CocosCreator3.8研究笔记(十九)CocosCreator UI组件(三)
893 0