添加時間:2013/2/12 13:27:23 編輯:奇億網(wǎng)站建設(shè)公司
我們經(jīng)常要用到在線客服代碼的站長估計會遇到,一般的在線客戶都是又復(fù)雜又多文件的,搞得浪費時間找個半天在哪修改客服;好不容易找個簡單的在線客服代碼卻又發(fā)現(xiàn)不兼容各大瀏覽器,急得不知道用哪種在線客服滾動代碼是好。
下面廣州奇億建站為您介紹一種簡單又兼容的在線滾動客服代碼:
<div id="divStayTopright" style="position:absolute; z-index:999;width:90px;height:150px; right:0px;"> 
<a href="tencent://message/?uin=81233044&Site=廣州建站&Menu=yes" target="_blank"><img src="images/qq.gif" width=90 height=150 border=0 alt="廣州建站廣州網(wǎng)站建設(shè)在線客服"></a>
</div> 
 
<script type="text/javascript"> 
//<![CDATA[
var tips; var theTop = 180/*這是默認(rèn)高度,越大越往下*/; var old = theTop;
function initFloatTips() {
  tips = document.getElementById('divStayTopright');
  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();
</script>
是吧,很簡單實用又兼容各大瀏覽器的在線客服滾動代碼吧!