可关闭带关闭按钮的悬浮图片广告代码分享:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <div class="hongbao_hd hide"> <div class="hd-code"> <div class="hd_close"></div> <a target="_blank" href="http://www.sujianbao.com/"> <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> |