实现一个简单的H5领红包的动画

直接上代码:

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="author" content="Tocersoft" />
		<meta content="telephone=no" name="format-detection" />
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<title>领红包</title>
		<!--标准mui.css-->
		<script src="jquery-1.8.1.min.js"></script>
		<link type="text/css" rel="stylesheet" media="all" href="mui.min.css">
		<style type="text/css">
			html,body{
				height:100%; 
				width:100%;
			}
			.errorMsg{
				text-align: center;
				letter-spacing: 1px;
				position: relative; 
				top: 50%;
				color : white;
				line-height:35px;
				width: 200px;
				margin: 0 auto;
				font-size: 20px;
			}
			.bottom-button{
				border: 1px solid #fff;
				color: #fff;
				height: 32px;
				width: 128px;
				text-align: center;
				font-size: 12px;
				line-height: 32px;
				border-radius: 16px;
				margin:0px auto;
			}
			.bottom-button1{
				border: 1px solid #fff;
				color: #fff;
				text-align: center;
				font-size: 20px;
				border-radius: 16px;
				margin: 0px auto;
				background-color: #ff6c60;
				bottom: 1%;
				position: absolute;
				width: 60%;
				height: 40px;
				margin-left: 20%;
				letter-spacing: 10px;
				font-weight: normal;
			}
			.bottom-button2{
				background-image: url(r-receive.png);
				width: 10rem;
				height: 10rem;
				background-position: center;
				background-repeat: no-repeat;
				background-size: 100% 100%;
				position: relative;
				left: 0;
				right: 0;
				z-index: 100;
				margin: auto;
				animation: beat 1s infinite;
			}
			@keyframes beat {
				0% {
					transform: rotate(0deg) scale(0.8, 0.8);
					opacity: 1;
				}
				25% {
					transform: rotate(0deg) scale(1, 1);
					opacity: 0.8;
				}
				100% {
					transform: rotate(0deg) scale(0.8, 0.8);
					opacity: 1;
				}
			}
			.bottom-receive{
				background-image: url(r-accomplish.png);
				background-position: center;
				background-repeat: no-repeat;
				background-size: 100% 100%;
				position: relative;
				left: 0;
				right: 0;
				z-index: 100;
				top: 0;
				bottom: 0;
				margin: auto;
				height:0px;
				width:0px;
				display: none;
				opacity: 0;
			}
			.bottom-receive .bottom-receive-money{
				position: relative;
				color: #ed6b5c;
				font-size: 30px;
				font-weight: 600;
				text-align: center;
				width: 100%;
				margin-top: 246.08px;
			}
			.bottom-receive .bottom-receive-title1{
				position: relative;
				color: #ffffff;
				width: 100%;
				left: 65px;
				margin-top: 66px;
			}
			.bottom-receive .bottom-receive-title2{
				position: relative;
				color: #ffffff;
				width: 100%;
				left: 65px;
				margin-top: 10px;
			}
			.mui-popover.mui-bar-nav.qrcode-position{
			    left: 10%!important;
   				width: 80%!important;
			}
			.act-popover .mui-popover-arrow.mui-bottom {
			    left: 200px!important;
			}
			.act-top-popover {
				top: 73px!important;
			}
			.act-top-popover .mui-popover-arrow {
				left: 185px!important;
			}
		</style>
		<script src="mui.min.js"></script>
		<script type="text/javascript">
			$(function(){
				$('.bottom-button2').css('margin-top', $(document.body).height() * 0.5);// 让领取按钮显示在手的上面
				$(".bottom-button2").on("click",function () {
					var self = this;
					$(self).css("display","none");
					$(".bottom-receive").css("display","block");//显示div
					$(".bottom-receive").animate({
						opacity:'1',
						height:'600px',
						width:'300px'
					}, 1500);
				})
			})
		</script>
	</head>

	<body>
		<div style="background-image: url(r-background.png);width: 100%;height:100%;background-size: 100% 100%!important;overflow:hidden;">
			<div class="bottom-button2"></div>
			<div class="bottom-receive">
				<div class="bottom-receive-money">100元</div>
				<div class="bottom-receive-title1">
					活动名称:<br>双十一领红活动
				</div>
				<div class="bottom-receive-title2">
					活动时间:<br>2021-11-10至2021-11-11
				</div>
			</div>
		</div>
	</body>
</html>

小例子:https://download.csdn.net/download/wodexiaoyang/16682065

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值