可展开收起的客服导航。

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>可展开和收起的在线客服代码</title>
 6 <style type="text/css">
 7 img{border:0;}
 8 ul,li{padding:0;margin:0;}
 9 .QQbox {z-index:99;right:0;width:128px;height:128px;position:absolute;}
10 .QQbox .press{right:0;width:36px;cursor:pointer;position:absolute;height:128px;}
11 .QQbox .Qlist{left:0;width:131px;position:absolute;height:128px;background:url(http://js.alixixi.com/images/floatServiceBj.gif) no-repeat left center;}
12 .QQbox .Qlist ul{padding:43px 0 0 21px;}
13 .QQbox .Qlist li{height:26px;margin-bottom:11px;_margin-bottom:7px; list-style-type:none;}
14 </style>
15 <script type="text/javascript">
16 window.onload = window.onresize = window.onscroll = function ()
17 {
18  var oBox = document.getElementById("divQQbox"); 
19  var oLine = document.getElementById("divOnline");
20  var oMenu = document.getElementById("divMenu");
21  var iScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
22  setTimeout(function ()
23  {
24   clearInterval(oBox.timer);
25   var iTop = (document.documentElement.clientHeight - oBox.offsetHeight)/2 + iScrollTop;
26   oBox.timer = setInterval(function ()
27   {
28    var iSpeed = (iTop - oBox.offsetTop) / 8;
29    iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
30    oBox.offsetTop == iTop ? clearInterval(oBox.timer) : (oBox.style.top = oBox.offsetTop + iSpeed + "px");
31   }, 30)
32  }, 100)
33  
34  oBox.onmouseover = function ()
35  {
36   this.style.width = 131 + "px";
37   oLine.style.display = "block";
38   oMenu.style.display = "none";
39  };
40  oBox.onmouseout = function ()
41  {
42   this.style.width = '';
43   oLine.style.display = "none";
44   oMenu.style.display = "block";
45  };
46 };
47 </script>
48 </head>
49 <body style="height:2000px;">
50 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
51 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
52 <!--在线客服 begin -->
53 <div class="QQbox" id="divQQbox" >
54 <div class="Qlist" id="divOnline" style="display:none;">
55 <ul>
56 <li><a href="#"><img src="http://js.alixixi.com/images/floatServiceWeb.gif" alt="网页方式"></a></li>
57 <li><a href="#"><img src="http://js.alixixi.com/images/floatServiceQq.gif" alt="QQ方式"></a></li>
58 </ul>
59 </div>
60 <div id="divMenu"><img src="http://js.alixixi.com/images/floatService.gif" class="press" alt="在线客服"></div>
61 </div>
62 
63 </body>
64 </html>

 

 

posted @ 2013-09-23 09:45  鲤鱼在睡觉  阅读(215)  评论(0编辑  收藏  举报