- 博客(0)
- 资源 (2)
- 收藏
- 关注
砸金蛋java例子
砸金蛋抽奖,jquery加jsp代码实现,可以自行设定抽奖概率,部分代码
var ctop=$(".fanzt-chuizi").position().top-20;
var cleft=$(".fanzt-chuizi").position().left+30;
//1.锤子抬起的动作
$(".fanzt-chuizi").animate({"top":ctop+"px","left":cleft+"px"},1500,function(){
//2.锤子抬起达到最顶点的动作
$(".fanzt-chuizi").css(
{
"-webkit-transform":"rotate(80deg)",
"-moz-transform":"rotate(80deg)",
"-o-transform":"rotate(80deg)",
"transform":"rotate(80deg)",
"-webkit-transition":"all 0.8s ease",
"-moz-transition":"all 0.8s ease",
"-o-transition":"all 0.8s ease",
"transition":"all 0.8s ease"
});
//3.锤子落下的动作
$(".fanzt-chuizi").animate({"top":(ctop+25)+"px","left":(cleft-50)+"px"},200,function(){
//4.锤子落下到达最低点
$(".fanzt-chuizi").css(
{
"-webkit-transform":"rotate(5deg)",
"-moz-transform":"rotate(5deg)",
"-o-transform":"rotate(5deg)",
"transform":"rotate(5deg)",
"-webkit-transition":"all 0.1s ease",
"-moz-transition":"all 0.1s ease",
"-o-transition":"all 0.1s ease",
"transition":"all 0.1s ease"
});
//5.金蛋破碎
$("#egg").attr("src","images/egg_2.png");
$(".fanzt-chuizi").hide();
//6.金花溅出
$(".fanzt-hua").slideDown(200);
//7.中奖结果
$(".fanzt-message").show(200);
$(".fanzt-message").find("b").text(data);
//8.程序处理
$(obj).attr("data-flag","1");//已砸蛋,不能再砸
2017-09-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人