js QQ客服悬浮效果实现代码

一段js实现的QQ客服悬浮特效代码,经常用在网页上显示QQ客服在线信息,很实用的一段代码

代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>QQ客服悬浮特效代码_</title> </head> <body> <script type="text/javascript"> window.onload = window.onresize = window.onscroll = function () { var oBox = document.getElementById("qqbox_zzjs"); var oLine = document.getElementById("online_lanrenzhijia"); var oMenu = document.getElementById("menu_zzjs_net"); var iScrollTop = document.documentElement.scrollTop || document.body.scrollTop; setTimeout(function () { clearInterval(oBox.timer); var iTop = parseInt((document.documentElement.clientHeight - oBox.offsetHeight)/2) + iScrollTop; oBox.timer = setInterval(function () { var iSpeed = (iTop - oBox.offsetTop) / 8; iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); oBox.offsetTop == iTop ? clearInterval(oBox.timer) : (oBox.style.top = oBox.offsetTop + iSpeed + "px"); }, 30) }, 100) oBox.onmouseover = function () { this.style.width = 131 + "px"; oLine.style.display = "block"; oMenu.style.display = "none"; }; oBox.onmouseout = function () { this.style.width = ''; oLine.style.display = "none"; oMenu.style.display = "block"; }; }; document.write("<style>img{border:0;}ul,li{padding:0;margin:0;}.box_lanrenzhijia {z-index:99;right:0;width:128px;height:195px;position:absolute;}.box_lanrenzhijia .press{right:0;width:36px;cursor:pointer;position:absolute;height:128px;}.box_lanrenzhijia .zzjs_net_list{left:0;width:131px;position:absolute;height:195px;background:url(images/20120321lanrenzhijia_1.gif) no-repeat left center;}.box_lanrenzhijia .zzjs_net_list ul{padding:37px 0 0 21px;}.box_lanrenzhijia .zzjs_net_list li{height:26px;margin-bottom:3px;_margin-bottom:3px; list-style-type:none;}</style><div class=https://www.jb51.net/article/\"box_lanrenzhijia\" id=https://www.jb51.net/article/\"qqbox_zzjs\"><div class=https://www.jb51.net/article/\"zzjs_net_list\" id=https://www.jb51.net/article/\"online_lanrenzhijia\" style=https://www.jb51.net/article/\"display:none;\"><ul><li><a href=https://www.jb51.net/article/\"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=脚本之家&Menu=yes\"><img src=https://www.jb51.net/article/\"images/20111126lanrenzhijia_3.gif\" alt=https://www.jb51.net/article/\"脚本之家一号客服\"></a></li><li><a href=https://www.jb51.net/article/\"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=脚本之家&Menu=yes\"><img src=https://www.jb51.net/article/\"images/20111126lanrenzhijia_3.gif\" alt=https://www.jb51.net/article/\"脚本之家二号客服\"></a></li><li><a href=https://www.jb51.net/article/\"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=脚本之家&Menu=yes\"><img src=https://www.jb51.net/article/\"images/20111126lanrenzhijia_3.gif\" alt=https://www.jb51.net/article/\"脚本之家三号客服\"></a></li><li><a href=https://www.jb51.net/article/\"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=脚本之家&Menu=yes\"><img src=https://www.jb51.net/article/\"images/20111126lanrenzhijia_3.gif\" alt=https://www.jb51.net/article/\"脚本之家四号客服\"></a></li><li><a href=https://www.jb51.net/article/\"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=脚本之家&Menu=yes\"><img src=https://www.jb51.net/article/\"images/20111126lanrenzhijia_3.gif\" alt=https://www.jb51.net/article/\"脚本之家五号客服\"></a></li></ul></div><div id=https://www.jb51.net/article/\"menu_zzjs_net\"><img src=https://www.jb51.net/article/\"images/20111126lanrenzhijia_4.gif\" class=https://www.jb51.net/article/\"press\" alt=https://www.jb51.net/article/\"在线客服\"></div></div>"); </script> </body> </html>

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgxsdg.html