JS+CSS实现可展开/收起的QQ在线客服悬浮代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JS+CSS实现可展开/收起的QQ在线客服悬浮代码丨德国kiddy安全座椅丨聚来宝是真的吗</title> <style type="text/css"> img{border:0;} ul,li{padding:0;margin:0;} .QQbox {z-index:99;right:0;width:128px;height:128px;position:absolute;} .QQbox .press{right:0;width:36px;cursor:pointer;position:absolute;height:128px;} .QQbox .Qlist{left:0;width:131px;position:absolute;height:128px;background:url(/imagesforcode/201209/floatServiceBj.gif) no-repeat left center;} .QQbox .Qlist ul{padding:43px 0 0 21px;} .QQbox .Qlist li{height:26px;margin-bottom:11px;_margin-bottom:7px; list-style-type:none;} </style> <script type="text/javascript"> window.onload = window.onresize = window.onscroll = function() { var oBox = document.getElementById("divQQbox"); var oLine = document.getElementById("divOnline"); var oMenu = document.getElementById("divMenu"); var iScrollTop = document.documentElement.scrollTop || document.body.scrollTop; setTimeout(function() { clearInterval(oBox.timer); var iTop = parseInt((document.documentElement.clientHeight - oBox.offsetHeight) / 2) + iScrollTop; oBox.timer = setInterval(function() { var iSpeed = (iTop - oBox.offsetTop) / 8; iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); oBox.offsetTop == iTop ? clearInterval(oBox.timer) : (oBox.style.top = oBox.offsetTop + iSpeed + "px"); }, 30) }, 100) oBox.onmouseover = function() { this.style.width = 131 + "px"; oLine.style.display = "block"; oMenu.style.display = "none"; }; oBox.onmouseout = function() { this.style.width = ‘‘; oLine.style.display = "none"; oMenu.style.display = "block"; }; }; </script> </head> <body style="height:2000px;"> <br>所需4个小图片:<a href="/imagesforcode/201209/floatServiceBj.gif" target="_blank">floatServiceBj.gif</a>、 <a href="/imagesforcode/201209/floatServiceWeb.gif" target="_blank">floatServiceWeb.gif</a>、 <a href="/imagesforcode/201209/floatServiceQq.gif" target="_blank">floatServiceQq.gif</a>、 <a href="/imagesforcode/201209/floatService.gif" target="_blank">floatService.gif</a> <br><hr> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <!--在线客服 begin --> <div class="QQbox" id="divQQbox" > <div class="Qlist" id="divOnline" style="display:none;"> <ul> <li><a href="#"><img src="/imagesforcode/201209/floatServiceWeb.gif" alt="网页方式"></a></li> <li><a href="#"><img src="/imagesforcode/201209/floatServiceQq.gif" alt="QQ方式"></a></li> </ul> </div> <div id="divMenu"><img src="/imagesforcode/201209/floatService.gif" class="press" alt="在线客服"></div> </div> <br /> </body> </html>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。