js代码
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/encryption-win.js"></script>
<script type="text/javascript">
$(function () {
document.querySelector('#me').addEventListener('click', function () {
$.ajax({
url: './winData.json',
method: 'get',
success: function (data) {
new Win({
el: '.lottery', //抽奖元素的父级
startIndex: 1, //从第几个位置开始抽奖 [默认为零]
totalCount: 4, //一共要转的圈数
// winningIndex: data.win, //中奖的位置索引[1-8] 后台返回的中奖数字
winningIndex: 3, //模拟写死的,实际效果可接受后台返回
speed: 50 //抽奖动画的速度 [数字越大越慢,默认100]
}, function () { //中奖后的回调函数
//do something
$('.lottery li').each(function () {
if ($(this).hasClass('active')) {
//打印当前中奖信息
console.log($(this).html());
$('.prize').html($(this).html());
}
});
});
}
});
})
});//end function
</script>
在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载


