|
悬浮 返回顶部 QQ客服代码 代码放到第三方统计
悬浮 返回顶部 QQ客服代码 代码放到第三方统计
- <style>.QQbox{z-index:25; width:65px; right:0; top:180px; position:absolute}.QQbox .Qlist{ width:50px; margin:0 auto; overflow:hidden;}
- .QQbox .Qlist em { cursor:pointer;}</style>
- <div class="QQbox" id="divQQbox" style="display:none">
- <div class="Qlist" id="divOnline">
- <a href="#" title="返回顶部"><img border="0" src="http://img13.poco.cn/mypoco/myphoto/20121029/12/5647189220121029125550079.gif" alt="返回顶部" /></a>
- </div>
- </div>
- <script type="text/javascript" >var tips;
- var theTop = 180/*这是默认高度,越大越往下*/;
- var old = theTop;
- function initFloatTips() {
- document.getElementById("divQQbox").style.display = "block";
- 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;
- }
- old = pos;
- setTimeout(moveTips, tt);
- }
- initFloatTips();
- //=点击展开关闭效果=
- function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){
- var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
- var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
- var openTip = oOpenTip || "";
- var shutTip = oShutTip || "";
- if(targetObj.style.display!="none"){
- if(shutAble) return;
- targetObj.style.display="none";
- if(openTip && shutTip){
- sourceObj.innerHTML = shutTip;
- }
- } else {
- targetObj.style.display="block";
- if(openTip && shutTip){
- sourceObj.innerHTML = openTip;
- }
- }
- }</script>
该帖子于 2013-06-22 12:03 编辑过
|