码迷,mamicode.com
首页 > Web开发 > 详细

JS+CSS实现可展开/收起的QQ在线客服悬浮代码

时间:2015-04-08 12:28:02      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

<!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>

 

JS+CSS实现可展开/收起的QQ在线客服悬浮代码

标签:

原文地址:http://www.cnblogs.com/youtianxia/p/4401734.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!