天天看點

php抽獎簡單源碼,php轉盤抽獎 完整例子源碼(含模拟資料)

轉盤抽獎,稍作修改就可用

執行個體截圖:

php抽獎簡單源碼,php轉盤抽獎 完整例子源碼(含模拟資料)

核心代碼:

幸運大轉盤-jQuery PHP實作的抽獎程式

.demo{width:417px; height:417px; position:relative; margin:50px auto}

#disk{width:417px; height:417px; background:url(luck/disk.jpg) no-repeat}

#start{width:163px; height:320px; position:absolute; top:46px; left:130px;}

#start img{cursor:pointer}

$(function(){

$("#startbtn").click(function(){

lottery();

});

});

function lottery(){

$.ajax({

type: 'POST',

url: 'data.php',

dataType: 'json',

cache: false,

error: function(){

alert('出錯了!');

return false;

},

success:function(json){

$("#startbtn").unbind('click').css("cursor","default");

var a = json.angle; //角度

var p = json.prize; //獎項

$("#startbtn").rotate({

duration:3000, //轉動時間

angle: 0,

animateTo:1800 a, //轉動角度

easing: $.easing.easeOutSine,

callback: function(){

var con = confirm('恭喜你,中得' p '\n還要再來一次嗎?');

if(con){

lottery();

}else{

return false;

}

}

});

}

});

}

幸運大轉盤-jQuery PHP實作的抽獎程式

php抽獎簡單源碼,php轉盤抽獎 完整例子源碼(含模拟資料)