带关闭按钮的悬浮图片代码



 带关闭按钮的悬浮图片代码  

<div class="hongbao_hd hide"> <div class="hd-code"> <div class="hd_close"></div> <a target="_blank" href="http://www.xueshengke.cn/"> <div class="code"> <span class="hd_waiting" ></span> </div> </a> </div> </div> <style> .hongbao_hd { position: fixed; z-index: 9999999; background: rgba(0,0,0,.5); width: 100%; height: 100%; top:0; } .hd-code a { width: 100%; height:100%; display: block; } .hongbao_hd .hd-code { width: 480px; height:480px; position: fixed; left: 50%; top: 50%; margin-top: -214px; margin-left: -250px; /*background: url("https://img.alicdn.com/imgextra/i4/2053469401/TB2JwPhcdLO8KJjSZPcXXaV0FXa_!!2053469401.png") no-repeat;*/ background: url("https://img.alicdn.com/imgextra/i4/2053469401/TB2Lkyvu_JYBeNjy1zeXXahzVXa-2053469401.png") no-repeat; background-size: 100%; } .code .hd_waiting { left: 0; text-align: center; position: absolute; bottom: 62px; color: #333; width: 100%; font-size: 18px; font-weight: bold; font-family: Microsoft YaHei; } .hd_close { cursor: pointer; position: absolute; bottom: -40px; right: 50%; margin-right: -15px; width: 30px; height: 30px; background: url('http://cmsstatic.dataoke.com//web/images/hd/ssy_hd_close.png') no-repeat; background-size: cover; } .hd-code .code { font-size: 12px; background: none; font-family: "Microsoft Yahei"; text-align: center; } </style> <script> //设置cookie function setCookie(c_name, value) { var exdate = new Date(); exdate.setTime(exdate.getTime() + 2 * 60 * 60 * 1000); //exdate.setTime(exdate.getTime() + 10 * 1000); document.cookie = c_name + "=" + escape(value) + (";path=/;expires=" + exdate.toGMTString()); } // 获取cookie function getCookie(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) c_end = document.cookie.length; return unescape(document.cookie.substring(c_start, c_end)); } } return ""; }; if(getCookie('hd_hongbao') == 1){ }else{ $('.hongbao_hd').removeClass('hide'); setCookie('hd_hongbao',1) } $('.hd_close,.hd-code a').on('click',function(){ $('.hongbao_hd').remove(); })//获取固件版本 </script>

发表评论: