jQuery手机端砸金蛋抽奖小游戏HTML5代码特效

jQuery手机端砸金蛋抽奖小游戏HTML5代码特效5445
HTML5砸金蛋抽奖手机代码是一款带活动说明,我的奖品,登记领奖的砸金蛋抽奖代码。
相关js代码
 function init() {

        var assetsPath = "images/";
        manifest = [
            {id: "bgMusic", src: "music.ogg"},
            {id: "img01", src: "agg.png"},
            {id: "img02", src: "agg-puo.png"},
            {id: "img03", src: "bg.jpg"},
            {id: "img04", src: "hammer.png"},
            {id: "img05", src: "jingnan.png"},
            {id: "img06", src: "logo.png"},
            {id: "img07", src: "sorry.png"},
            {id: "img08", src: "stage.png"},
            {id: "img09", src: "qrcode.png"}
        ];

        js.Sound.alternateExtensions = ["mp3"];
        preload = new js.LoadQueue(true, assetsPath);
        preload.installPlugin(js.Sound);
        preload.addEventListener("complete", doneLoading);
        preload.addEventListener("progress", updateLoading);
        preload.loadManifest(manifest);

        function updateLoading() {
            $("#loadtext").text("Loading " + (preload.progress * 100 | 0) + "%");
        }

        //loading完毕
        function doneLoading(event) {
            //js.Sound.play("laser");
            $("#loading").hide();
            // start 播放背景音乐
            js.Sound.play("bgMusic", {interrupt: js.Sound.INTERRUPT_NONE, loop: -1, volume: 0.4});
        }

        var Musicplay = true;
        $("#music").on('click', function(){
            if(Musicplay == true){
                js.Sound.stop("bgMusic");
                $("#music").addClass("Musicpaused");
                Musicplay = false;
            }
            else {
                js.Sound.play("bgMusic");
                $("#music").removeClass("Musicpaused");
                Musicplay = true;
            }

        });

        var winH = $(window).innerHeight();
        var winW = $(window).innerWidth();
        $("body,.gamebox,.jn-box").css({height:winH,width:winW});

        $("#chance").text(chance);
        
        var YesorNo = true;
        function aClick() {

            $(".agg").off("click", aClick);

            chance-=1;
            $("#chance").text(chance);

            if(chance<0){
                chance = 0;
                $("#chance").text(chance);
                alert("你今天的5次砸蛋机会已经用完!");
                $(".agg").on("click", aClick);
            }
            else {
                var _this = $(this);
                _this.parents(".lanren").addClass("paused");
                _this.html('<img src="images/hammer.png" class="hammer"><img src="images/agg-puo.png" class="agg-puo">');

                setTimeout(function () {
                    _this.css({background:"none"}).find(".agg-puo").show();

                    setTimeout(function () {
//是否中奖
                        

                        if (YesorNo == true){
                            $("#sorryBox").show();
                            YesorNo = false;
                        }
                        else {
                            $(".lanren").hide();
                            $(".winBox").show().find("img").attr("src","images/jp-1.png");
                            $(".footer").find("p").html("<button class='btn' style='margin: 1.5% 0;'>登记领奖</button>").on("click",function () {
                                $("#fromBox").show();
                            })
                            YesorNo = true;
                        }

                    },500);
                },250);
            }

        }

也许你还喜欢