大转盘游戏

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<style type="text/css" media="screen">
.bg-light{
width: 400px;
height: 400px;
background: url(img/ly-plate-c.gif) no-repeat;
margin: 0 auto;
position: relative;
}
.bg-lottery{
width: 340px;
height: 340px;
background: url(img/bg-lottery.png) no-repeat;
margin: 0 auto;
position: absolute;
left: 50%;
top:50%;
margin-left: -170px;
margin-top: -170px;
}
.playbtn{
position: absolute;
width: 186px;
height: 186px;
background: url(img/playbtn.png) no-repeat;
left: 50%;
top:50%;
margin-left: -93px;
margin-top: -93px;
cursor: pointer;
}
</style>
<script src="js/jquery.min.js"></script>


</head>
<body>
<div class="bg-light">
<img src="img/bg-lottery.png" class="bg-lottery">
<img src="img/playbtn.png" alt="" class="playbtn">
</div>
<script src="js/jquery.rotate.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var $btn = $('.playbtn');//按钮
var playnum = 6; //初始次数,由后台传入
var isture = 0;
var clickfunc = function() {
var data = [1, 2, 3, 4, 5, 6];
//data为随机出来的结果,根据概率后的结果
data = data[Math.floor(Math.random() * data.length)];
switch(data) {
case 1:
rotateFunc(1, 360, '1111112000');
break;
case 2:
rotateFunc(2, 60, '666661000');
break;
case 3:
rotateFunc(3, 120, '2222谢谢');
break;
case 4:
rotateFunc(4, 180, '444444京东');
break;
case 5:
rotateFunc(5, 240, '5200');
break;
case 6:
rotateFunc(6, 300, '谢谢');
break;
}
}
$('.playbtn').click(function(){
clickfunc();
});
var rotateFunc = function(awards, angle, text) {
isture = true;
$btn.stopRotate();


$(".bg-lottery").rotate({
angle: 0,
duration: 4000, //旋转时间
animateTo: angle+1800, //让它根据得出来的结果加上1440度旋转
callback: function() {
isture = false; // 标志为 执行完毕
alert(text);
}
});
};
});
</script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值