郑州SEO—SEO站长(阿权)

郑州seo-阿权团队网络营销服务中.....承接:网站建设、网站优化、网络推广、营销策划、商务外包等业务,咨询QQ:346363458

qq浮动客服代码

 以前阿权站长曾写过一篇关于QQ在线交谈代码的文章,今天阿权站长要分享的代码是一款好看的qq浮动在线客服代码,本代码特点:QQ在线客服好控制,可进行QQ在线客服进行分类。缺点:代码有点太长,不过放在</body></html>后面也没有多大影响。关于本段代码的例子效果:请参照重工机械网

展开效果如下,不展开时是一个浮动图片,鼠标放到图片时QQ在线客服展开:

QQ浮动在线客服

居浏览器右测滑动条处的QQ浮动在线客服

下面直接看qq浮动在线客服代码(两步)

 简单说明:其中的346+363458是阿权站长的个人QQ,用的时候,您可要换成是自己的QQ;每个类别最后都有:<div class="qqkfhm bgdh"></div> 发的这个可以删除,删除后下面将不会留空白,若您需要添加更多的QQ客服,请多复制这样一个div便可。

1、把以下代码放在您想要qq浮动在线客服效果页面的</body></html>后面:

<div class="qqbox" id="divQQbox">
  <div class="qqlv" id="meumid" onmouseover="show()"><img src="upload/201302210833025333.gif" /></div>
  <div class="qqkf" style="display:none;" id="contentid" onmouseout="hideMsgBox(event)">

    <div class="qqkfbt" onClick="showandhide('qq-','qqkfbt','qqkfbt','K',3,1);" id="qq-1" onfocus="this.blur();">客 服 中 心</div>
    <div id="K1">
      <div class="qqkfhm bgdh"><a href="tencent://message/?uin=346363458" title='&nbsp;客服客服1号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;客服中心1号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"><a href="tencent://message/?uin=346363458" title='&nbsp;客服客服2号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;客服中心2号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"><a href="tencent://message/?uin=346363458" title='&nbsp;客服客服3号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;客服中心3号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"><a href="tencent://message/?uin=346363458" title='&nbsp;客服客服4号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;客服中心4号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"><a href="tencent://message/?uin=346363458" title='&nbsp;客服客服5号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;客服中心5号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"></div>
    </div>

    <div class="qqkfbt" onClick="showandhide('qq-','qqkfbt','qqkfbt','K',3,2);" id="qq-2" onfocus="this.blur();">售 后 服 务</div>
    <div id="K2" style="display:none">
   
      <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;售后客服1号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;售后客服1号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;售后客服2号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;售后客服2号</a> </div>
      <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;售后客服3号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;售后客服3号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;售后客服4号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;售后客服4号</a> </div>
      <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;售后客服4号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;售后客服5号</a> </div>
      <div class="qqkfhm bgdh"></div>
    </div>

    <div class="qqkfbt"  onClick="showandhide('qq-','qqkfbt','qqkfbt','K',3,3);" id="qq-3" onfocus="this.blur();">投 诉 中 心</div>
    <div id="K3" style="display:none">
      <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;投诉客服1号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;投诉中心1号</a> <br/>
        </div>
        <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;投诉中心2号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;投诉中心2号</a> <br/>
        </div>
        <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;投诉中心3号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;投诉中心3号</a> <br/>
        </div>
        <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;投诉中心4号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;投诉中心4号</a> <br/>
        </div>
         <div class="qqkfhm bgdh"><a href='tencent://message/?uin=346363458' title='&nbsp;投诉中心5号'><img src='upload/201302210833045511.gif' border='0'>&nbsp;投诉中心5号</a> <br/>
        </div>
      <div class="qqkfhm bgdh"></div>
    </div>

  </div>
</div>

<script>
function showandhide(h_id,hon_class,hout_class,c_id,totalnumber,activeno) {
    var h_id,hon_id,hout_id,c_id,totalnumber,activeno;
    for (var i=1;i<=totalnumber;i++) {
        document.getElementById(c_id+i).style.display='none';
        document.getElementById(h_id+i).className=hout_class;
    }
    document.getElementById(c_id+activeno).style.display='block';
    document.getElementById(h_id+activeno).className=hon_class;
}
var tips;
var theTop = 100;
var old = theTop;
function initFloatTips()
{
    tips = document.getElementById('divQQbox');
    moveTips();
}
function moveTips()
{
           var tt=50;
          if (window.innerHeight)
          {
              pos = window.pageYOffset 
          }else if (document.documentElement && document.documentElement.scrollTop) {
             pos = document.documentElement.scrollTop 
          }else if (document.body) {
            pos = document.body.scrollTop; 
          }
         
          pos=pos-tips.offsetTop+theTop;
          pos=tips.offsetTop+pos/10;
          if (pos < theTop){
             pos = theTop;
          }
          if (pos != old) {
             tips.style.top = pos+"px";
             tt=10;  //alert(tips.style.top); 
          }
          old = pos;
          setTimeout(moveTips,tt);
}
initFloatTips();

    if(typeof(HTMLElement)!="undefined")    //给firefox定义contains()方法,ie下不起作用
        { 
          HTMLElement.prototype.contains=function (obj) 
          { 
              while(obj!=null&&typeof(obj.tagName)!="undefind"){ //通过循环对比来判断是不是obj的父元素
           if(obj==this) return true; 
               obj=obj.parentNode;
               } 
              return false; 
          }
    }
function show()
{
    document.getElementById("meumid").style.display="none"
    document.getElementById("contentid").style.display="block"
}
    function hideMsgBox(theEvent){
      if (theEvent){
        var browser=navigator.userAgent;
        if (browser.indexOf("Firefox")>0){  //如果是Firefox
            if (document.getElementById("contentid").contains(theEvent.relatedTarget)) {  //如果是子元素
                return
            }
        }
        if (browser.indexOf("MSIE")>0 || browser.indexOf("Presto")>=0){  //如果是IE
            if (document.getElementById('contentid').contains(event.toElement)) {  //如果是子元素
                return;  //结束函式
            }
        }
      }
      document.getElementById("meumid").style.display = "block";
      document.getElementById("contentid").style.display = "none";
     }
</script>

2、在您的css文件的后面加入以下代码,若单独在根目录另建一个qq.css文件,则需要在添加qq浮动在线客服代码的页面头部都加上 <link href="qq.css" rel="stylesheet" type="text/css" />

div,form,img,ul,ol,li,dl,dt,dd,p {margin: 0; padding: 0; border: 0;}
ul{
 list-style-type:none;
}
.qqbox a:link {
 color: #000;
 text-decoration: none;
}
.qqbox a:visited {
 color: #000;
 text-decoration: none;
}
.qqbox a:hover {
 color: #f80000;
 text-decoration: underline;
}
.qqbox a:active {
 color: #f80000;
 text-decoration: underline;
}

.qqbox{
    width:132px;
    height:auto;
    overflow:hidden;
    position:absolute;
    right:0;
    top:100px;
    color:#000000;
    font-size:12px;
    letter-spacing:0px;
}
.qqlv{
    width:25px;
    height:256px;
    overflow:hidden;
    position:relative;
    float:right;
    z-index:50px;
}
.qqkf{
    width:120px;
    height:auto;
    overflow:hidden;
    right:0;
    top:0;
    z-index:99px;
    border:6px solid #138907;
    background:#fff;
}
.qqkfbt{
    width:118px;
    height:20px;
    overflow:hidden;
    background:#138907;
    line-height:20px;
    font-weight:bold;
    color:#fff;
    position:relative;
    border:1px solid #9CD052;
    cursor:pointer;
    text-align:center;
}
.qqkfhm{
    width:112px;
    height:22px;
    overflow:hidden;
    line-height:22px;
    padding-right:8px;
    position:relative;
    margin:3px 0;
}

.bgdh{
    width:102px;
    padding-left:10px;
}

本文地址:http://www.seozz.net/zzseo/qqkefu.html

本文标题:qq浮动客服代码

« 上一篇 下一篇 »

发表留言:取消回复

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By 阿权站长

Copyright【豫ICP备09037741号-2】联系我们Your WebSite.给我留言 Some Rights Reserved.