码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-07-14 13:52:32      阅读:229      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!