jQuery实现悬浮在右上角的网页客服效果代码

2019-12-17,,

本文实例讲述了jQuery实现悬浮在右上角的网页客服效果代码。分享给大家供大家参考,具体如下:

这是款网页在线客服代码,应用了jquery插件,兼容性不错。默认状态下,客服只显示一个图片Button,用鼠标点击时展开全部内容,可用作QQ客服,售后客服等,可以作为网站快速通道,方便用户进行相应的操作。

运行效果截图如下:

在线演示地址如下:

http://demo.jb51.net/js/2015/jquery-right-top-wen-online-demo/

具体代码如下:

<!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=gb2312">
<style type="text/css">
.demo_menu{font-size: 14px;text-align: center;margin: 10px 0 0 0;color: #999;line-height: 180%;}
.demo_menu b{color: #333;}
.demo_menu a, .demo_menu a: visited{color: #F00;font-size: 14px;}
.demo_menu a: hover{color: #090;font-size: 14px;}
body{background: #ccc;}
.text{font-size: 12px;}
#kefu{position: fixed;_position: absolute;_top: expression(documentElement.scrollTop + 20 + "px");top: 20px;right: 0;z-index: 999}
#kefu .box-content{position: relative;background-color: #fff;width: 170px;}
#kefu .title-btn, #kefu .qq, #kefu .phone, #kefu .service, #kefu .on span{background: url(images/kefu.png) no-repeat}
#kefu .title-btn{width: 33px;height: 97px;position: absolute;top: 0;left: -33px;}
#kefu .title-btn span{display: none}
#kefu .on span{background-position: -129px 7px;height: 16px;display: block;}
#kefu .pad{padding: 16px 10px 10px;overflow: hidden;font-size: 12px;}
#kefu .pad a{text-decoration: none;}
#kefu .qq{background-position: 0 -118px;display: inline-block;zoom: 1;*display: inline;padding-left: 16px;}
#kefu .phone{height: 28px;background-position: 0 -153px;margin: 18px 0}
#kefu .service{display: inline-block;zoom: 1;*display: inline;height: 51px;background-position: 0 -203px;width: 151px;margin-left: 3px}
#kefu .text{background-color: #ededed;padding: 5px 10px;text-align: center}
#kefu .off{width: 0;}
#kefu .off .pad, #kefu .off .text{display: none}
p, p a{font-size: 12px;color: #666;}
</style>
<title>始终固定在网页右上角的在线客服QQ代码</title>
<meta http-equiv="X-UA-Compatible" content="IE=7">
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="kefu">
 <div class="box-content off">
  <div class="title-btn cu"><span><a href="#"></a></span></div>
  <div class="pad"> <a href="http://sighttp.qq.com/msgrd?v=3&uin=12345678&site=qq&menu=yes" class="qq" style="margin-right:16px">售前咨询</a><a href="http://sighttp.qq.com/msgrd?v=3&uin=12345678&site=qq&menu=yes" class="qq">广告-合作</a>
   <div class="phone"></div>
   <a href="#" class="service" target="_blank"></a> </div>
  <div class="text"> 客服时间:(9:00-18:00)<br>
   (周六日休息) </div>
 </div>
</div>
<script type="text/javascript"> 
$(".select").hover(
 function () {
  $(this).find(".msgNav").show();
 },
 function () {
  $(this).find(".msgNav").hide();
 }
);
$(".title-btn").toggle(
 function () {
  $(this).addClass("on");
    $(this).parent(".box-content").removeClass("off");
 },
 function () {
  $(this).removeClass("on");
    $(this).parent(".box-content").addClass("off");
 }
);
</script>
</body>
</html>

希望本文所述对大家jQuery程序设计有所帮助。

您可能感兴趣的文章:

  • jquery鼠标放上去显示悬浮层即弹出定位的div层
  • jquery实现的可隐藏重现的靠边悬浮层实例代码
  • 使用jQuery UI的tooltip函数修饰title属性的气泡悬浮框
  • 自定义一个jquery插件[鼠标悬浮时候 出现说明label]
  • jquery实现鼠标悬浮停止轮播特效
  • jquery悬浮提示框完整实例
  • 鼠标悬浮显示二级菜单效果的jquery实现
  • jQuery简单实现页面元素置顶时悬浮效果示例
  • jQuery鼠标悬浮链接弹出跟随图片实例代码
  • jQuery实现的简单悬浮层功能完整实例

《jQuery实现悬浮在右上角的网页客服效果代码.doc》

下载本文的Word格式文档,以方便收藏与打印。