悬浮广告&漂浮广告

来源:互联网 发布:深圳二手房成交数据 编辑:程序博客网 时间:2024/04/19 18:08

悬浮

<style>  .floatad{ position:fixed; left:10px; bottom:10px;}  .floatad .close{ text-align:left}  .floatad .close a{ font-size:12px; text-decoration:none; color:#000;}  .floatad .box img{}  </style><script>  function turnoff(obj){  document.getElementById(obj).style.display="none";  }  </script>  <div class="floatad" id="floatad">  <div class="close"><a href="javascript:void(0);" title="点击关闭" onclick="javascript:turnoff('floatad')">[X]</a> </div>  <div class="box"><a href="#" target="_blank"><img src="https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png" /></a></div></div>

漂浮

<style type="text/css">#img1{position:absolute;top:43px;left:2px;z-index:10;}#img1 div{text-align:right;font-size:12px;}#img1 div a:link{text-decoration:none;}#img1 div a:hover{color:red;text-decoration:none;}#img1 img{}</style><div id="img1" onmouseover="pause_resume()" onmouseout="pause_resume()"><div><a href="javascript:void(0);" onclick="closediv()" title="点击关闭">关闭</a></div><a href="http://www.msxindl.com/" target="_blank"><img src="/templets/moban/imgcssjs/code3.jpg" alt="可关闭的自由漂浮的图片广告特效代码"></a></div><script type="text/javascript">var xPos = 300;var yPos = 200; var step = 1;var delay = 30; var height = 0;var Hoffset = 0;var Woffset = 0;var yon = 0;var xon = 0;var pause = true;var interval;var divid = img1; //浮动DIV的ID.divid.style.top = yPos;function changePos(){   width = document.body.clientWidth;   height = document.body.clientHeight;   Hoffset = divid.offsetHeight;   Woffset = divid.offsetWidth;   divid.style.left = xPos + document.body.scrollLeft + "px";   divid.style.top = yPos + document.body.scrollTop + "px";   if(yon){yPos = yPos + step;}else{yPos = yPos - step;}   if(yPos < 0){yon = 1;yPos = 0;}   if(yPos >= (height - Hoffset)){yon = 0; yPos = (height - Hoffset);}   if(xon){xPos = xPos + step;}else{xPos = xPos - step;}   if(xPos < 0){xon = 1;xPos = 0;}   if(xPos >= (width - Woffset)){xon = 0; xPos = (width - Woffset);}}function start(){   divid.visibility = "visible";   interval = setInterval('changePos()',delay);}function pause_resume(){   if(pause){   clearInterval(interval);   pause = false;}   else{   interval = setInterval('changePos()',delay);   pause = true;    }}function closediv(){   clearInterval(interval);   divid.style.display = "none";}start();</script>







0 0
原创粉丝点击