基于Zepto+CSS3宝箱开启动画抽奖JS特效代码,先来看看效果:
部分核心的代码如下:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- <link rel="stylesheet" href="http://imgcache.gtimg.cn/vipstyle/mobile/global/mqqui/v1/css/global.css"> -->
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/atom.css">
<link rel="stylesheet" href="css/global.css">
<link rel="stylesheet" href="css/open.css">
<title>基于Zepto+CSS3宝箱开启动画抽奖JS特效代码</title>
</head>
<body ontouchstart="" class="open-body">
<div class="wrapper">
<div class="bg rotate"></div>
<div class="open-has ">
<h3 class="title-close"><span class="user">德水</span>给你发了一个宝箱</h3>
<!-- <h3 class="title-open">恭喜你,成功领取<span class="user">德水</span>发的宝箱</h3> -->
<h3 class="title-open">恭喜你,</br>成功领取<span class="user">一二三四五六</span>发的全民飞机大战宝箱</h3>
<div class="mod-chest">
<div class="chest-close show ">
<div class="gift"></div>
<div class="tips">
<i class="arrow"></i>
</div>
</div>
<div class="chest-open ">
<div class="mod-chest-cont open-cont">
<div class="content">
<div class="gift">
<div class="icon"><img src="img/chest-icon-zuan.png"></div> x 500
</div>
<div class="func">
<button class="chest-btn">查看详情并提取</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="open-none" style="display:none">
<h3>你来晚啦,下次早点吧!</h3>
<div class="mod-chest">
<div class="chest-open show"></div>
</div>
<div class="func">
<button class="chest-btn">查看领取详情</button>
</div>
</div>
<div class="chest-notice">
<input type="checkbox" id="notice-checkbox">
<label for="notice-checkbox">关注PHP中文网</label>
</div>
</div>
<script type="text/javascript" src="js/zepto.min.js"></script>
<script type="text/javascript">
$(".chest-close").click(function(){
$(this).addClass("shake");
var that=this;
this.addEventListener("webkitAnimationEnd", function(){
$(that).closest(".open-has").addClass("opened");
setTimeout(function(){
$(that).removeClass("show");
$(that).closest(".mod-chest").find(".chest-open").addClass("show");
setTimeout(function(){
$(".chest-open").addClass("blur");
},500)
},200)
}, false);
})
</script>
</body>
</html>
<div style="display:none">
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F6f798e51a1cd93937ee8293eece39b1a' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_5718743'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s9.cnzz.com/stat.php%3Fid%3D5718743%26show%3Dpic2' type='text/javascript'%3E%3C/script%3E"));</script>
</div>