基本信息
源码名称:jQueryRotate圆盘抽奖插件例子下载(转盘抽奖)
源码大小:0.35M
文件格式:.rar
开发语言:js
更新时间:2015-04-24
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元×
微信扫码支付:1 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
实现简单的转盘抽奖
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>jQueryRotate圆盘抽奖插件</title> | |
<style type="text/css"> | |
*{padding:0;margin:0} | |
body{ | |
text-align:center | |
} | |
.ly-plate{ | |
position:relative; | |
width:509px; | |
height:509px; | |
margin: 50px auto; | |
} | |
.rotate-bg{ | |
width:509px; | |
height:509px; | |
background:url(ly-plate.png); | |
position:absolute; | |
top:0; | |
left:0 | |
} | |
.ly-plate div.lottery-star{ | |
width:214px; | |
height:214px; | |
position:absolute; | |
top:150px; | |
left:147px; | |
/*text-indent:-999em; | |
overflow:hidden; | |
background:url(rotate-static.png); | |
-webkit-transform:rotate(0deg);*/ | |
outline:none | |
} | |
.ly-plate div.lottery-star #lotteryBtn{ | |
cursor: pointer; | |
position: absolute; | |
top:0; | |
left:0; | |
*left:-107px | |
} | |
</style> | |
</head> | |
<body> | |
<div class="ly-plate"> | |
<div class="rotate-bg"></div> | |
<div class="lottery-star"><img src="rotate-static.png" id="lotteryBtn"></div> | |
</div> | |
<script type="text/javascript" src="js/jquery.min.js"></script> | |
<script type="text/javascript" src="js/jQueryRotate.2.2.js"></script> | |
<script type="text/javascript" src="js/jquery.easing.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
var timeOut = function(){ //超时函数 | |
$("#lotteryBtn").rotate({ | |
angle:0, | |
duration: 10000, | |
animateTo: 2160, //这里是设置请求超时后返回的角度,所以应该还是回到最原始的位置,2160是因为我要让它转6圈,就是360*6得来的 | |
callback:function(){ | |
alert('请继续') | |
} | |
}); | |
}; | |
var rotateFunc = function(awards,angle,text){ //awards:奖项,angle:奖项对应的角度 | |
$('#lotteryBtn').stopRotate(); | |
$("#lotteryBtn").rotate({ | |
angle:0, | |
duration: 5000, | |
animateTo: angle 1440, //angle是图片上各奖项对应的角度,1440是我要让指针旋转4圈。所以最后的结束的角度就是这样子^^ | |
callback:function(){ | |
alert(text) | |
} | |
}); | |
}; | |
$("#lotteryBtn").rotate({ | |
bind: | |
{ | |
click: function(){ | |
var time = [0,1]; | |
time = time[Math.floor(Math.random()*time.length)]; | |
if(time==0){ | |
timeOut(); //网络超时 | |
} | |
if(time==1){ | |
var data = [1,2,3,0]; //返回的数组 | |
data = data[Math.floor(Math.random()*data.length)]; | |
if(data==1){ | |
rotateFunc(1,157,'恭喜您抽中的一等奖') | |
} | |
if(data==2){ | |
rotateFunc(2,247,'恭喜您抽中的二等奖') | |
} | |
if(data==3){ | |
rotateFunc(3,22,'恭喜您抽中的三等奖') | |
} | |
if(data==0){ | |
var angle = [67,112,202,292,337]; | |
angle = angle[Math.floor(Math.random()*angle.length)] | |
rotateFunc(0,angle,'很遗憾,这次您未抽中奖') | |
} | |
} | |
} | |
} | |
}); | |
}) | |
</script> | |
</body> | |
</html> |