网站侧边客服代码 折叠式 圆球客服展示
时间:2023年10月02日
/来源:网络
/编辑:佚名
首先是html代码:
<section id="cebian">
<div class="all close">
<div class="shang">
<div class="mune">
<p>Chat with us!</p>
<a href="#"><i class="iconfont icon-weixin2"></i></a>
</div>
<div class="mune">
<p>Phone</p>
<a href="#"><i class="iconfont icon-dianhuatianchong"></i></a>
</div>
<div class="mune">
<p>Email</p>
<a href="#"><i class="iconfont icon-youxiang2"></i></a>
</div>
<div class="mune">
<p>Sign up</p>
<a href="#"><i class="iconfont icon-yonghu"></i></a>
</div>
<div class="mune">
<p>Chat</p>
<a href="#"><i class="iconfont icon-message_full"></i></a>
</div>
<div id="open">
<a href="#"><i class="iconfont icon-guanbi"></i></a>
</div>
</div>
</div>
</section>
然后是css代码:
* {
margin: 0;
padding: 0;
}
#cebian {
background: rgba(255, 255, 255, 0.8);
position: fixed;
z-index: 1;
width: 100vw;
height: 100vh;
top: 0;
}
#cebian .all {
position: absolute;
right: 0;
bottom: 0;
padding: 0 30px 30px 0;
}
#cebian .all .shang {
display: flex;
flex-direction: column;
}
#cebian .all .shang>div {
display: flex;
justify-content: flex-end;
height: 44px;
margin-bottom: 15px;
}
#cebian .all .shang>div>a {
height: 44px;
line-height: 44px;
text-align: center;
text-decoration: none;
width: 44px;
display: block;
box-shadow: 0 2px 8px 0px rgba(0, 0, 0, 0.1);
border-radius: 50%;
}
#cebian .all .shang>div:nth-child(1) a {
background: #ffcb00;
}
#cebian .all .shang>div:nth-child(2) a {
background: #63c956;
}
#cebian .all .shang>div:nth-child(3) a {
background: #be1867;
}
#cebian .all .shang>div:nth-child(4) {
background: #ffcb00;
display: none;
}
#cebian .all .shang>div:nth-child(5) a {
background: #2d41a9;
}
#cebian .all .shang>div:nth-child(6) a {
background: #008afc;
width: 50px;
height: 50px;
line-height: 50px;
}
#cebian .all .shang>div>a>.iconfont {
color: #fff;
font-size: 20px;
}
#cebian .all .shang>div>p {
margin: 8px 15px;
border: 1px solid #fff;
padding: 6px 8px;
color: #1d2d3c;
line-height: 1em;
font-size: 14px;
border-radius: 4px;
box-shadow: 0 0 8px #ccc;
background: #fff;
}
#cebian .all .shang .mune {
opacity: 0.9;
}
#cebian .all .shang .none {
display: none;
}
.cebian {
background: none;
width: 0;
height: 0;
top: unset;
right: 0;
bottom: 0;
}
接下来是js代码:
$(function () {
var open = false;
var first = true;
if (first) {
$("#open a i").addClass("icon-a-13Ashenglve");
$("#open a i").removeClass("icon-guanbi");
$(".mune").addClass("none");
$("#cebian").css({ "background": "none", "width": "0", "height": "0", "top": "unset", "right": "0", "bottom": "0" });
first = !first;
}
$("#cebian").click(function () {
if (open) {
$("#open a i").addClass("icon-a-13Ashenglve");
$("#open a i").removeClass("icon-guanbi");
$(".mune").addClass("none");
$("#cebian").css({ "background": "none", "width": "0", "height": "0", "top": "unset", "right": "0", "bottom": "0" });
open = !open;
} else {
$("#open a i").removeClass("icon-a-13Ashenglve");
$("#open a i").addClass("icon-guanbi");
$(".mune").removeClass("none");
$("#cebian").attr("style", "");
open = !open;
}
});
});
需要引入jQuery才行生效!同时iconfont需要自己去引入或者查找对应的图标
<section id="cebian">
<div class="all close">
<div class="shang">
<div class="mune">
<p>Chat with us!</p>
<a href="#"><i class="iconfont icon-weixin2"></i></a>
</div>
<div class="mune">
<p>Phone</p>
<a href="#"><i class="iconfont icon-dianhuatianchong"></i></a>
</div>
<div class="mune">
<p>Email</p>
<a href="#"><i class="iconfont icon-youxiang2"></i></a>
</div>
<div class="mune">
<p>Sign up</p>
<a href="#"><i class="iconfont icon-yonghu"></i></a>
</div>
<div class="mune">
<p>Chat</p>
<a href="#"><i class="iconfont icon-message_full"></i></a>
</div>
<div id="open">
<a href="#"><i class="iconfont icon-guanbi"></i></a>
</div>
</div>
</div>
</section>
然后是css代码:
* {
margin: 0;
padding: 0;
}
#cebian {
background: rgba(255, 255, 255, 0.8);
position: fixed;
z-index: 1;
width: 100vw;
height: 100vh;
top: 0;
}
#cebian .all {
position: absolute;
right: 0;
bottom: 0;
padding: 0 30px 30px 0;
}
#cebian .all .shang {
display: flex;
flex-direction: column;
}
#cebian .all .shang>div {
display: flex;
justify-content: flex-end;
height: 44px;
margin-bottom: 15px;
}
#cebian .all .shang>div>a {
height: 44px;
line-height: 44px;
text-align: center;
text-decoration: none;
width: 44px;
display: block;
box-shadow: 0 2px 8px 0px rgba(0, 0, 0, 0.1);
border-radius: 50%;
}
#cebian .all .shang>div:nth-child(1) a {
background: #ffcb00;
}
#cebian .all .shang>div:nth-child(2) a {
background: #63c956;
}
#cebian .all .shang>div:nth-child(3) a {
background: #be1867;
}
#cebian .all .shang>div:nth-child(4) {
background: #ffcb00;
display: none;
}
#cebian .all .shang>div:nth-child(5) a {
background: #2d41a9;
}
#cebian .all .shang>div:nth-child(6) a {
background: #008afc;
width: 50px;
height: 50px;
line-height: 50px;
}
#cebian .all .shang>div>a>.iconfont {
color: #fff;
font-size: 20px;
}
#cebian .all .shang>div>p {
margin: 8px 15px;
border: 1px solid #fff;
padding: 6px 8px;
color: #1d2d3c;
line-height: 1em;
font-size: 14px;
border-radius: 4px;
box-shadow: 0 0 8px #ccc;
background: #fff;
}
#cebian .all .shang .mune {
opacity: 0.9;
}
#cebian .all .shang .none {
display: none;
}
.cebian {
background: none;
width: 0;
height: 0;
top: unset;
right: 0;
bottom: 0;
}
接下来是js代码:
$(function () {
var open = false;
var first = true;
if (first) {
$("#open a i").addClass("icon-a-13Ashenglve");
$("#open a i").removeClass("icon-guanbi");
$(".mune").addClass("none");
$("#cebian").css({ "background": "none", "width": "0", "height": "0", "top": "unset", "right": "0", "bottom": "0" });
first = !first;
}
$("#cebian").click(function () {
if (open) {
$("#open a i").addClass("icon-a-13Ashenglve");
$("#open a i").removeClass("icon-guanbi");
$(".mune").addClass("none");
$("#cebian").css({ "background": "none", "width": "0", "height": "0", "top": "unset", "right": "0", "bottom": "0" });
open = !open;
} else {
$("#open a i").removeClass("icon-a-13Ashenglve");
$("#open a i").addClass("icon-guanbi");
$(".mune").removeClass("none");
$("#cebian").attr("style", "");
open = !open;
}
});
});
需要引入jQuery才行生效!同时iconfont需要自己去引入或者查找对应的图标
新闻资讯 更多
- 【建站知识】查询nginx日志状态码大于400的请求并打印整行04-03
- 【建站知识】Python中的logger和handler到底是个什么?04-03
- 【建站知识】python3拉勾网爬虫之(您操作太频繁,请稍后访问)04-03
- 【建站知识】xpath 获取meta里的keywords及description的方法04-03
- 【建站知识】python向上取整以50为界04-03
- 【建站知识】scrapy xpath遇见乱码解决04-03
- 【建站知识】scrapy爬取后中文乱码,解决word转为html 时cp1252编码问题04-03
- 【建站知识】scrapy采集—爬取中文乱码,gb2312转为utf-804-03