鍍金池/ 問(wèn)答/HTML5  PHP  HTML/ 轉(zhuǎn)盤抽獎(jiǎng)概率為0怎么設(shè)置

轉(zhuǎn)盤抽獎(jiǎng)概率為0怎么設(shè)置

360*(jsn.weeks || 4)是什么意思

下邊是js中的代碼
function turntableDraw(obj,jsn)
{


"use strict";
this.draw = {};
this.draw.obj = $(obj);
this.draw.objClass = $(obj).attr("class");
this.draw.newClass = "rotary"+"new"+parseInt(Math.random()*1000);
var _jiaodu = parseInt(360/jsn.share);
var _yuan = 360*(jsn.weeks || 4);
var _str = "";
var _speed = jsn.speed || "2s";
var _velocityCurve = jsn.velocityCurve || "ease";
var _this = this;
for(var i=1;i<=jsn.share;i++)
{
    _str+="."+this.draw.newClass+i+"{";
    _str+="transform:rotate("+((i-1)*_jiaodu+_yuan)+"deg);";
    _str+="-ms-transform:rotate("+((i-1)*_jiaodu+_yuan)+"deg);";
    _str+="-moz-transform:rotate("+((i-1)*_jiaodu+_yuan)+"deg);";
    _str+="-webkit-transform:rotate("+((i-1)*_jiaodu+_yuan)+"deg);";
    _str+="-o-transform:rotate("+((i-1)*_jiaodu+_yuan)+"deg);";
    _str+="transition: transform "+_speed+" "+_velocityCurve+";";
    _str+="-moz-transition: -moz-transform "+_speed+" "+_velocityCurve+";";
    _str+="-webkit-transition: -webkit-transform "+_speed+" "+_velocityCurve+";";
    _str+="-o-transition: -o-transform "+_speed+" "+_velocityCurve+";";
    _str+="}";
    _str+="."+this.draw.newClass+i+"stop{";
    _str+="transform:rotate("+((i-1)*_jiaodu)+"deg);";
    _str+="-ms-transform:rotate("+((i-1)*_jiaodu)+"deg);";
    _str+="-moz-transform:rotate("+((i-1)*_jiaodu)+"deg);";
    _str+="-webkit-transform:rotate("+((i-1)*_jiaodu)+"deg);";
    _str+="-o-transform:rotate("+((i-1)*_jiaodu)+"deg);";
    _str+="}";
};
$(document.head).append("<style>"+_str+"</style>");
_speed = _speed.replace(/s/,"")*1000;
this.draw.startTurningOk = false;
this.draw.goto=function(ind){
    if(_this.draw.startTurningOk){return false};
    _this.draw.obj.attr("class",_this.draw.objClass+" "+_this.draw.newClass+ind);
    _this.draw.startTurningOk = true;
    setTimeout(function(){
        _this.draw.obj.attr("class",_this.draw.objClass+" "+_this.draw.newClass+ind+"stop");
        if(jsn.callback)
        {
            _this.draw.startTurningOk = false;
            jsn.callback(ind);
        };
    },_speed+10);
    return _this.draw;
};
return this.draw;

};

下邊是html頁(yè)面的代碼

<script>
$(".box .img01").load(function() {

var obj = $(".drawBtn");
var hei = $(this).height();//獲取當(dāng)前圖片的高度
var hei2 = obj.height();//獲取點(diǎn)擊的那個(gè)指針圖片的高度
obj.css("top",(hei - hei2)/2);//給指針設(shè)置高度為兩個(gè)值相減的一半

});
$(".box1 .img01").load(function() {

var obj = $(".drawBtn2");
var hei = $(this).height();
var hei2 = obj.height();
obj.css("top",(hei - hei2)/2);

});
</script>
<script>
//share份額[數(shù)字沒(méi)有默認(rèn)],
//speed速度[單位s,最小0.1s],
//velocityCurve速度曲線[linear勻速,ease慢快慢,ease-in慢慢開(kāi)始,ease-out慢慢結(jié)束,ease-in-out慢快慢等,用的是css3的速度曲線],可以不寫(xiě),ease默認(rèn)值;
//callback回調(diào)函數(shù)
//weeks幾周[默認(rèn)2周,可以不寫(xiě)]

//幾份和回調(diào)函數(shù)這兩個(gè)參數(shù)是必填

function callbackA(ind)
{

alert("第一個(gè)回調(diào)"+ind);

};
function callbackB(ind)
{

alert("第二個(gè)回調(diào)"+ind);

};
var newdraw =new turntableDraw('.drawBtn',{

share:8,
speed:"3s",
velocityCurve:"ease",
weeks:6,
callback:function(num)
{
    callbackA(num);
},

});
var newdraw2 =new turntableDraw('.drawBtn2',{

share:12,
speed:"3s",
velocityCurve:"ease",
weeks:6,
callback:function(num)
{
    callbackB(num);
},

});
$(".drawBtn").click(function(event) {

//ajax
var hitArea = [2,5,8];
var hit = hitArea.length-1;
//getRandomNum(0, hitArea.length-1);
newdraw.goto(parseInt(Math.random()*8)+1);

});
$(".drawBtn2").click(function(event) {

//ajax
newdraw2.goto(parseInt(Math.random()*12)+1);

});
</script>

怎樣控制中獎(jiǎng)的概率為0

回答
編輯回答
抱緊我

黑心企業(yè),才不告訴你o(′^`)o

2017年2月3日 08:45