h5春节小游戏制作
话不多说,直接上代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="viewport"
content="width=320,maximum-scale=1.3,user-scalable=no"
/>
<title>Document</title>
<link rel="stylesheet" href="./css/siper.min.css" />
<link rel="stylesheet" href="./css/reset.min.css" />
<link rel="stylesheet" href="./css/public.min.css" />
<link rel="stylesheet" href="./css/index.css" />
<link rel="stylesheet" href="./css/animate.min.css" />
<script
type="text/javascript"
src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"
></script>
<script src="./js/font-size.min.js"></script>
<style>
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-wrapper {
width: 4rem;
height: 6rem !important;
}
.swiper-slide {
text-align: center;
font-size: 18px;
width: 4rem;
height: 1rem;
line-height: 100px;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
background-size: 100%;
}
.active {
background: url("./img/congratulatory_kuang.png") no-repeat center;
background-size: 100%, 100%;
}
.active span {
color: #ca0000 !important;
}
.swiper-slide {
height: 1rem !important;
}
.swiper-slide span {
font-size: 0.6rem;
font-family: "方正榜书行简体";
color: #ffe291;
height: 42px;
line-height: 42px;
}
.refresh {
position: absolute;
line-height: 100px;
bottom: 100%;
text-align: center;
width: 100%;
}
.loadmore {
position: absolute;
line-height: 20px;
top: 100%;
text-align: center;
width: 100%;
}
.swiper-scrollbar-drag {
height: 2rem !important;
}
.congratulatory .next {
top: 9.3rem;
left: 4rem;
}
.congratulatory .prev {
top: 9.3rem;
right: 2rem;
}
.congratulatory .select_niu {
width: 4rem;
top: 2.5rem;
left: 1.7rem;
}
.congratulatory .swiper-slide span {
width: 60%;
}
.congratulatory .swiper-slide:nth-child(1) span {
background: url("./img/congratulatory1.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(1).active span {
background: url("./img/congratulatory11.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(2) span {
background: url("./img/congratulatory2.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(2).active span {
background: url("./img/congratulatory22.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(3) span {
background: url("./img/congratulatory3.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(3).active span {
background: url("./img/congratulatory33.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(4) span {
background: url("./img/congratulatory4.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(4).active span {
background: url("./img/congratulatory44.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(5) span {
background: url("./img/congratulatory5.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(5).active span {
background: url("./img/congratulatory55.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(6) span {
background: url("./img/congratulatory6.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(6).active span {
background: url("./img/congratulatory66.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(7) span {
background: url("./img/congratulatory7.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(7).active span {
background: url("./img/congratulatory77.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(8) span {
background: url("./img/congratulatory8.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(8).active span {
background: url("./img/congratulatory88.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(9) span {
background: url("./img/congratulatory9.png") no-repeat center;
background-size: 100%;
}
.congratulatory .swiper-slide:nth-child(9).active span {
background: url("./img/congratulatory99.png") no-repeat center;
background-size: 100%;
}
</style>
</head>
<body class="o-hidden" style="height: 100vh">
<div class="w750 o-hidden">
<div class="w750 p-r bg index">
<div class="p-a text_time p-r">
<div class="xwf_2021 animated fadeInRight fast"></div>
<div
class="xwf_2022 animated fadeInRight fast"
style="animation-delay: 0.5s"
></div>
<div
class="xwf_2023 animated fadeInRight fast"
style="animation-delay: 1s"
></div>
<div
class="xwf_2024 animated fadeInRight fast"
style="animation-delay: 1.5s"
></div>
<div
class="xwf_2025 p-a animated fadeInRight fast"
style="animation-delay: 2s"
>
<img src="./img/jinniu.png" alt="" />
</div>
</div>
<div class="p-a niu">
<img src="./img/niu.png" alt="" />
</div>
<div class="p-a text animated fadeInLeft fast delay-1s"></div>
</div>
<div class="w750 p-r box hidden">
<div class="select">
<!-- 牛 -->
<div class="select_niu p-a">
<img class="hidden" src="./img/one_show.png" alt="" />
<img class="hidden" src="./img/two_show.png" alt="" />
<img class="visib" src="./img/three_show.png" alt="" />
<img class="hidden" src="./img/four_show.png" alt="" />
<img class="hidden" src="./img/five_show.png" alt="" />
</div>
<!-- 确认选择 -->
<div class="confirm p-a" style="top: 6.7rem; left: 2.5rem">
<span>确认选择</span>
</div>
<!-- 切换形象 -->
<div class="switch p-a d-flex">
<div class="animated tada fast delay-1s">点击牛</div>
<div class="animated tada fast delay-2s">切换</div>
<div class="animated tada fast delay-3s">形象</div>
</div>
<!-- 云 -->
<div class="xwf_cloud p-r">
<div class="p-a left"></div>
<div class="p-a right"></div>
</div>
<!-- 转盘 -->
<div class="turntable p-r" style="top: 1rem">
<div class="p-a one"><img src="./img/one.png" alt="" /></div>
<div class="p-a two"><img src="./img/two.png" alt="" /></div>
<div class="p-a three"><img src="./img/three.png" alt="" /></div>
<div class="p-a four"><img src="./img/four.png" alt="" /></div>
<div class="p-a five"><img src="./img/five.png" alt="" /></div>
</div>
<!-- 指针 -->
<div class="pointer p-a"></div>
</div>
</div>
<div class="congratulatory w750 p-r hidden">
<div class="select">
<!-- 牛 -->
<div class="select_niu p-a o-hidden">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide active"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
<div class="swiper-slide"><span></span></div>
</div>
</div>
</div>
<!-- 上一步 预览海报 -->
<div>
<div class="confirm p-a prev">
<span>上一步</span>
</div>
<div class="confirm p-a next">
<span>预览海报</span>
</div>
</div>
<!-- 云 -->
<div class="xwf_cloud p-r">
<div class="p-a left"></div>
<div class="p-a right"></div>
</div>
</div>
</div>
<div class="w750 congratulatory1 hidden">
<div class="select p-r">
<div class="p-r">
<img
src="./img/one_show.png"
alt=""
class="p-a"
style="width: 3rem; height: 4rem; top: 2.5rem; left: 2.3rem"
/>
<div class="select_niu p-a p-r">
<img class="p-a hidden" src="./img/niu_bg.png" />
<img class="p-a hidden" src="./img/niu_bg.png" />
<img class="p-a hidden&