给网站侧栏广告位带关闭按钮,可自行调试下css代码适配自己的网页!
<style> #right_bottom{width:163px;height:313px;position:fixed;bottom:0;right:18px;left:10%;} #right_bottom img{width:100%;height:100%;border-radius:5px;} #right_bottom #fuchuanga{ position: absolute;right: 0px;top: 0; background: rgba(0, 0, 0, 0.48); color: #FFF;font-size: 14px;padding: 5px 16px;text-decoration: none;border-radius: 4px;cursor: pointer;} #right_bottom span{position: absolute;left: 10px;top: 10;font-size:13px;} </style> <div id="right_bottom"> <a rel="nofollow" href="http://shop.8gws.com" target="_blank"><img src="http://bbs.8gws.com/content/templates/htzyw/lib/images/gou.gif"></a><a id="fuchuanga" href="javaScript:void(0)">关闭</a> </div> <script> $("#right_bottom a").on('click',function(){ $("#right_bottom").remove(); }); var time = 60; var closeAd = setInterval(function(){ if(time==0){ $("#right_bottom").remove(); clearInterval(closeAd); } $("#right_bottom span").html(time + " 秒后自动关闭"); time--; },1000) </script>