//状态 function hasdoctype() { var ret=false; try { if(document.compatMode=="BackCompat") ret=false; else if (document.compatMode=="CSS1Compat") ret=true; else ret=true; } catch(e) { ret=false; } return ret; } //浏览器类型 function detectBrowser() { var ret="ie6"; var user_agent = navigator.userAgent; if(user_agent.indexOf("compatible")>-1) { if(user_agent.indexOf("MSIE 6.0") > -1) ret="ie6"; else if(user_agent.indexOf("MSIE 7.0") > -1) ret="ie7"; else if(user_agent.indexOf("MSIE 8.0") > -1) ret="ie8"; if(user_agent.indexOf("360") > -1) { ret="360"; } } else if(user_agent.indexOf("Gecko") > -1) { ret="firefox"; } if(""=="TheWorld") { ret="TheWorld"; } return ret; } //获取IE var hasdoctype=hasdoctype(); var browser=detectBrowser(); // 滚动 function smoothMove(start,end) { kf.config["isscroll"]=false; var step=Math.abs(end-start); var forword = end-start; if(step>2) { step=Math.ceil(step*0.2)*(forword/Math.abs(forword)); } else { step=step*(forword/Math.abs(forword)); } posi=start+step; if(step>0) { if(posi>end) posi=end; } else { if(posi"; html += "
"+kf+"
"; document.getElementById(this.config["iconDiv"]).innerHTML=html; this.iconDivMain=document.getElementById(this.config["iconDivMain"]); } //滚动条滚动 function scroll() { try { this.offsetLeft=this.iconDivMain.offsetLeft; this.width=parseInt(this.iconDivMain.style.width.replace("px","")); this.height=parseInt(this.iconDivMain.style.width.replace("px","")); } catch(e) { return; } this.scrollbarW=20; this.scrolledY = document.body.scrollTop; this.scrolledX = document.body.scrollLeft; if(this.scrolledY==0)this.scrolledY = document.documentElement.scrollTop; if(this.scrolledX==0)this.scrolledX = document.documentElement.scrollLeft; if(browser=="ie6"){ this.pageH = document.documentElement.offsetHeight; this.pageW = document.documentElement.offsetWidth; } else if(browser=="ie7") { this.pageH = document.documentElement.offsetHeight; if(hasdoctype)this.pageW = document.documentElement.offsetWidth+21; else this.pageW = document.documentElement.offsetWidth; } else if(browser=="ie8") { this.pageH = document.documentElement.offsetHeight; this.pageW = document.documentElement.offsetWidth; } else if(browser=="firefox") { this.pageH = window.innerHeight; this.pageW = document.documentElement.clientWidth+21; } else { this.pageH = document.documentElement.offsetHeight; this.pageW = document.documentElement.offsetWidth; } if(this.top!=(this.scrolledY+this.config["offsetH"])) { this.top=this.scrolledY+this.config["offsetH"]; } if(this.config["showmodel"]==1) { if(this.left!=(this.scrolledX+this.pageW)) { var iconDivWidth=this.scrolledX+this.config["offsetW"]-this.offsetLeft; iconDivWidth=(iconDivWidth>0?1:-1)*Math.ceil(Math.abs(iconDivWidth)); this.left=this.offsetLeft+iconDivWidth; } } else { if(this.left!=(this.scrolledX+this.pageW-this.width-this.config["offsetW"]-this.scrollbarW)) { var iconDivWidth=this.scrolledX+this.pageW-this.width-this.config["offsetW"]-this.scrollbarW-this.offsetLeft; iconDivWidth=(iconDivWidth>0?1:-1)*Math.ceil(Math.abs(iconDivWidth)); this.left=this.offsetLeft+iconDivWidth; } } //右下角客服图标,超出窗口边界,直接移动到窗口边界再平滑移动 var left=parseInt(this.iconDivMain.style.left.replace("px","")); var top=parseInt(this.iconDivMain.style.top.replace("px","")); if(this.issmooth==true) { if(left!=this.left) { if(left<(this.scrolledX-this.width)) left=this.scrolledX-this.width; if(left>this.scrolledX+this.pageW) left=this.scrolledX+this.pageW; if(browser=="360" || browser=="TheWorld") { left=this.left; if(this.iconDivMain.style.display=="none") { this.recover = false; } else { this.iconDivMain.style.display = "none"; this.recover = true; } this.iconDivMain.style.left=left+"px"; if(this.recover==true) { this.iconDivMain.style.display = "block"; } } else { left=smoothMove(left,this.left); } } if(top!=this.top) { if(top<(this.scrolledY-this.height)) top=this.scrolledY-this.height; if(top>this.scrolledY+this.pageH) top=this.scrolledY+this.pageH; if(browser=="360" || browser=="TheWorld") { top=this.top; if(this.iconDivMain.style.display=="none") { this.recover = false; } else { this.iconDivMain.style.display = "none"; this.recover = true; } this.iconDivMain.style.top=top+"px"; if(this.recover==true) { this.iconDivMain.style.display = "block"; } } else { top=smoothMove(top,this.top); } } } else if(this.issmooth==false) { left=this.left; top=this.top; this.issmooth=true; } if(browser!="360") { this.iconDivMain.style.left=left+"px"; this.iconDivMain.style.top=top+"px"; if(kf.messageDiv && ! kf.config["isscroll"]) { kf.messageDiv.style.top=top-300+"px"; } } } //客服图标属性 function kfIcon() { this.config=new Array(); this.left=-200; this.top=0; this.width=0; this.height=0; this.offsetLeft=0; this.scrolledX=0; this.scrolledY=0; this.issmooth=false; if(browser=="360" || browser=="TheWorld") this.loopmillisecond=600; else this.loopmillisecond=30; this.Xstep=4; this.Ystep=4; this.pageW=0; this.pageH=0; this.display=""; this.iconDiv=null; this.iconDivMain=null; this.messageDiv=null; this.Isinviteds=null; this.autoScroll=scroll; this.init=_init; this.isscroll=false; this.wopen=_wopen; this.createIconDivMain=_createIconDivMain; }; function _wopen() { window.open(this.config["zdyurl"],"_blank","status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no"); if(typeof(dDoMask) == 'function'){ dDoMask(); } }; //构造函数 function _init() { document.write('
'); this.iconDiv=document.getElementById(this.config["iconDiv"]); this.createIconDivMain(); }; var kf=new kfIcon(); kf.config["isoff"]=parseInt("0");//客服在线状态 kf.config["height"]="89"; kf.config["width"]="100"; kf.config["showmodel"]=parseInt("2"); kf.config["offsetW"]=parseInt("1"); kf.config["offsetH"]=parseInt("500"); kf.config["kfimg"]="http://kf.jianke.com/images/off.gif";//离线客服图标 kf.config["iconDiv"]="iconDiv"; kf.config["iconDivMain"]="iconDivMain"; kf.config["messageDiv"]="messageDiv"; kf.config["keyword"]="' escape(document.referrer) '"; kf.config["zdyurl"]="http://kf.jianke.com/webCompany.aspx?arg=zuiya&zd_kf=auto"; kf.init(); eval('window.setInterval("kf.autoScroll()", '+kf.loopmillisecond+');');