首页 > 语言 > JavaScript > 正文

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

2024-05-06 16:11:56
字体:大 中 小
来源:转载
供稿:网友

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

代码:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  5. <title>QQ客服悬浮特效代码_www.vevb.com</title> 
  6. </head> 
  7. <body style="height:2000px;"> 
  8. <script type="text/javascript"> 
  9. windowwindow.onload = window.onresize = window.onscroll = function () 
  10. { 
  11. var oBox = document.getElementById("qqbox_zzjs"); 
  12. var oLine = document.getElementById("online_lanrenzhijia"); 
  13. var oMenu = document.getElementById("menu_zzjs_net"); 
  14. var iScrollTop = document.documentElement.scrollTop || document.body.scrollTop; 
  15. setTimeout(function () 
  16. { 
  17. clearInterval(oBox.timer); 
  18. var iTop = parseInt((document.documentElement.clientHeight - oBox.offsetHeight)/2) + iScrollTop; 
  19. oBox.timer = setInterval(function () 
  20. { 
  21. var iSpeed = (iTop - oBox.offsetTop) / 8; 
  22. iSpeediSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); 
  23. oBox.offsetTop == iTop ? clearInterval(oBox.timer) : (oBoxoBox.style.top = oBox.offsetTop + iSpeed + "px"); 
  24. }, 30) 
  25. }, 100) 
  26. oBox.onmouseover = function () 
  27. { 
  28. this.style.width = 131 + "px"; 
  29. oLine.style.display = "block"; 
  30. oMenu.style.display = "none"; 
  31. }; 
  32. oBox.onmouseout = function () 
  33. { 
  34. this.style.width = ''; 
  35. oLine.style.display = "none"; 
  36. oMenu.style.display = "block"; 
  37. }; 
  38. }; 
  39. 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=/"box_lanrenzhijia/" id=/"qqbox_zzjs/"><div class=/"zzjs_net_list/" id=/"online_lanrenzhijia/" style=/"display:none;/"><ul><li><a href=/"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=武林网&Menu=yes/"><img src=/"images/20111126lanrenzhijia_3.gif/" alt=/"武林网一号客服/"></a></li><li><a href=/"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=武林网&Menu=yes/"><img src=/"images/20111126lanrenzhijia_3.gif/" alt=/"武林网二号客服/"></a></li><li><a href=/"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=武林网&Menu=yes/"><img src=/"images/20111126lanrenzhijia_3.gif/" alt=/"武林网三号客服/"></a></li><li><a href=/"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=武林网&Menu=yes/"><img src=/"images/20111126lanrenzhijia_3.gif/" alt=/"武林网四号客服/"></a></li><li><a href=/"http://wpa.qq.com/msgrd?V=1&Uin=123456789&Site=武林网&Menu=yes/"><img src=/"images/20111126lanrenzhijia_3.gif/" alt=/"武林网五号客服/"></a></li></ul></div><div id=/"menu_zzjs_net/"><img src=/"images/20111126lanrenzhijia_4.gif/" class=/"press/" alt=/"在线客服/"></div></div>"); 
  40. </script> 
  41. </body> 
  42. </html> 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选