首页 > Web开发 > 详细

jquery砸金蛋 高仿阿里旅游砸金蛋

时间:2015-07-14 13:51:44      阅读:823      评论:0      收藏:0      [点我收藏+]

function zadan(obj) {

    $(obj).children("span").hide();

    eggClick($(obj));

};

function donghua() {

    $("#hammer").animate({

        top : "150px",

        left : "420px"

    }, 1000);

    $("#hammer").animate({

        top : "110px",

        left : "455px"

    }, 1000);

 

}

var dingshi = setInterval("donghua()", 2000);

var dansui = 1;

function eggClick(obj) {

 

    if (dansui == 0) {

        alert("蛋都碎掉了");

        return;

    }

 

    $("#hammer").stop(true);

    clearInterval(dingshi);

    var _this = obj;

 

    $(".hammer").css({

        "top" : "170px",

        "left" : "420px"

    });

    setTimeout(function () {

        _this.addClass("curr"); //蛋碎效果

        _this.find("sup").show(); //金花四溅

        $(".hammer").hide(); //隐藏锤子

        $(‘.resultTip‘).css({

            display : ‘block‘,

            top : ‘280px‘,

            left : ‘315px‘,

            opacity : 0

        }).animate({

            top : ‘240px‘,

            opacity : 1

        }, 300, function () {

            dansui = 0;

            $("#result").html("恭喜,您中得" + rs.data.prize);

 

        })

    }, 300);

 

}

技术分享


jquery砸金蛋 高仿阿里旅游砸金蛋

原文:http://my.oschina.net/yonghan/blog/478276

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!