// Description: JS版高兼容型悬浮在线客服面板
// Author: 尔今 erx@qq.com [熙右创想]
// update: 2013-9-28
var xymbgcolor = "#660000"; //面板颜色
var ogmargintop = 100; //与顶边距离
var InterTime = 1;
var maxWidth = -1;
var minWidth = -140; //默认隐藏宽度
document.writeln("");
document.writeln("
");
document.writeln("
客服在线
");
document.writeln("
");
document.writeln("
");
document.writeln("-
在线客服 ");
document.writeln("-
售后客服 ");
document.writeln("- 客服热线电话:
13541149455 ");
document.writeln("- 扫描微信二维码
");
document.writeln("
");
document.writeln("
");
document.writeln("
");
document.writeln("
");
document.writeln("
");
var numInter = 8;
var BigInter;
var SmallInter;
var o = document.getElementById("xykfp");
var i = parseInt(o.style.right);
function Big() {
if (parseInt(o.style.right) < maxWidth) {
i = parseInt(o.style.right);
i += numInter;
o.style.right = i + "px";
if (i == maxWidth) clearInterval(BigInter);
}
}
function toBig() {
clearInterval(SmallInter);
clearInterval(BigInter);
BigInter = setInterval(Big, InterTime);
}
function Small() {
if (parseInt(o.style.right) > minWidth) {
i = parseInt(o.style.right);
i -= numInter;
o.style.right = i + "px";
if (i == minWidth) clearInterval(SmallInter);
}
}
function toSmall() {
clearInterval(SmallInter);
clearInterval(BigInter);
SmallInter = setInterval(Small, InterTime);
}
xykfpanel = function(id, _top, _right) {
var me = id.charAt ? document.getElementById(id) : id,
d1 = document.body,
d2 = document.documentElement;
// d1.style.height = d2.style.height = '100%';
d2.style.height = '100%';
me.style.top = _top ? _top + 'px': 0;
me.style.right = _right + "px";
me.style.position = 'absolute';
setInterval(function() {
me.style.top = parseInt(me.style.top) + (Math.max(d1.scrollTop, d2.scrollTop) + _top - parseInt(me.style.top)) * 0.1 + 'px';
},
10 + parseInt(Math.random() * 20));
return arguments.callee;
};
window.onload = function() {
xykfpanel('xykfp', ogmargintop, minWidth)
}
toBig();