jQuery实现右侧抽屉式在线客服功能

2020-05-27 17:58:55易采站长站整理

我们先来看下实际运行效果图:

先给大家看下整体代码:


<!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" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>jQuery橙色右侧抽屉式在线客服代码_软件开发网</title>
<link href="css/lrtk.css" rel="external nofollow" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<script>
$(function() {
// 悬浮窗口
$(".yb_conct").hover(function() {
$(".yb_conct").css("right", "5px");
$(".yb_bar .yb_ercode").css('height', '200px');
}, function() {
$(".yb_conct").css("right", "-127px");
$(".yb_bar .yb_ercode").css('height', '53px');
});
// 返回顶部
$(".yb_top").click(function() {
$("html,body").animate({
'scrollTop': '0px'
}, 300)
});
});
</script>
</head>
<body>
<!-- 代码 开始 -->
<div class="yb_conct">
<div class="yb_bar">
<ul>
<li class="yb_top">返回顶部</li>
<li class="yb_phone">400-123-456</li>
<li class="yb_QQ">
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=123456789&site=qq&menu=yes&from=message&isappinstalled=0" rel="external nofollow" title="即刻发送您的需求">在线咨询</a>
</li>
<li class="yb_ercode" style="height:53px;">微信二维码 <br>
<img class="hd_qr" src="images/weixin.jpg" width="125" alt="关注你附近"> </li>
</ul>
</div>
</div>
<!-- 代码 结束 -->

<div style="text-align:center;margin:50px 0">
<p>使用方法:</p>
<p>1、在head区域引入样式表文件lrtk.css</p><p>2、在head区域引入jquery.js和js代码</p><p>3、在你的网页中加入<!-- 代码 开始 --><!-- 代码 结束 -->注释区域代码</p><p>4、QQ号码和电话号码,二维码图片修改成你自己的就可以了。</p></p>
<p style="margin:20px 0"></p>
</div>
</body>
</html>

其中CSS样式表代码:


@charset "utf-8";
/*-----------------初始化---------------------*/
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
a{text-decoration:none;color:#333;}