h5红包雨代码_html5移动端手机微信抢红包雨代码

js代码

$(document).ready(function() {

var win = (parseInt($(".couten").css("width"))) - 60;

$(".mo").css("height", $(document).height());

$(".couten").css("height", $(document).height());

$(".backward").css("height", $(document).height());

$("li").css({});

// 点击确认的时候关闭模态层

$(".sen a").click(function(){

$(".mo").css("display", "none")

});

var del = function(){

nums++;

//console.info(nums);

//console.log($(".li" + nums).css("left"));

$(".li" + nums).remove();

setTimeout(del,200)

}

var add = function() {

var hb = parseInt(Math.random() * (3 - 1) + 1);

var Wh = parseInt(Math.random() * (70 - 30) + 20);

var Left = parseInt(Math.random() * (win - 0) + 0);

var rot = (parseInt(Math.random() * (45 - (-45)) - 45)) + "deg";

//console.log(rot)

num++;

$(".couten").append("

");

$(".li" + num).css({

"left": Left,

});

$(".li" + num + " a img").css({

"width": Wh,

"transform": "rotate(" + rot + ")",

"-webkit-transform": "rotate(" + rot + ")",

"-ms-transform": "rotate(" + rot + ")", /* Internet Explorer */

"-moz-transform": "rotate(" + rot + ")", /* Firefox */

"-webkit-transform": "rotate(" + rot + ")",/* Safari 和 Chrome */

"-o-transform": "rotate(" + rot + ")" /* Opera */

});

$(".li" + num).animate({'top':$(window).height()+20},5000,function(){

//删掉已经显示的红包

this.remove()

});

//点击红包的时候弹出模态层

$(".li" + num).click(function(){

$(".mo").css("display", "block")

});

setTimeout(add,200)

}

//增加红包

var num = 0;

setTimeout(add,3000);

//倒数计时

var backward = function(){

numz--;

if(numz>0){

$(".backward span").html(numz);

}else{

$(".backward").remove();

}

setTimeout(backward,1000)

}

var numz = 4;

backward();

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值