右侧悬浮QQ客服

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>右侧悬浮QQ客服</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        body {
            font-family: "Microsoft YaHei", sans-serif;
            height: 2000px;
            background-color: #f5f5f5;
        }
        
        .float-qq {
            position: fixed;
            right: 0;
            top: 50%;
            margin-top: -100px;
            width: 40px;
            background-color: #12B7F5;
            border-radius: 5px 0 0 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
            z-index: 9999;
            transition: all 0.3s ease;
        }
        
        .float-qq:hover {
            width: 160px;
        }
        
        .float-qq-item {
            height: 40px;
            line-height: 40px;
            text-align: center;
            color: white;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        
        .float-qq-item:hover {
            background-color: #0E9BD5;
        }
        
        .float-qq-item i {
            display: inline-block;
            width: 40px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            font-size: 20px;
            float: left;
        }
        
        .float-qq-item span {
            display: inline-block;
            width: 120px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            float: left;
            font-size: 14px;
        }
        
        .float-qq-item .qq-num {
            position: absolute;
            right: 10px;
            top: 0;
            background-color: #FF6B6B;
            color: white;
            font-size: 12px;
            padding: 2px 5px;
            border-radius: 10px;
            line-height: 1;
            transform: scale(0.8);
        }
        
        .float-qq-top {
            border-radius: 5px 0 0 0;
        }
        
        .float-qq-bottom {
            border-radius: 0 0 0 5px;
        }
        
        .float-qq-tel {
            background-color: #FF6B6B;
        }
        
        .float-qq-tel:hover {
            background-color: #E74C3C;
        }
        
        .float-qq-qrcode {
            position: absolute;
            right: 50px;
            top: 0;
            width: 120px;
            height: 120px;
            background-color: white;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
            padding: 10px;
            display: none;
        }
        
        .float-qq-qrcode img {
            width: 100%;
            height: 100%;
        }
        
        .float-qq-qrcode:after {
            content: "";
            position: absolute;
            right: -10px;
            top: 20px;
            width: 0;
            height: 0;
            border-top: 10px solid transparent;
            border-bottom: 10px solid transparent;
            border-left: 10px solid white;
        }
    </style>
</head>
<body>
    <!-- 右侧悬浮QQ客服 -->
    <div class="float-qq">
        <div class="float-qq-item float-qq-top">
            <i></i>
            <span>在线咨询</span>
        </div>
        <div class="float-qq-item">
            <i></i>
            <span>QQ客服1</span>
            <span class="qq-num">123456</span>
        </div>
        <div class="float-qq-item">
            <i></i>
            <span>QQ客服2</span>
            <span class="qq-num">654321</span>
        </div>
        <div class="float-qq-item float-qq-bottom float-qq-tel">
            <i></i>
            <span>电话咨询</span>
            <span class="qq-num">400-123-4567</span>
        </div>
    </div>

    <!-- 页面内容 -->
    <div style="padding: 20px;">
        <h1>网页内容区域</h1>
        <p>向下滚动页面,右侧悬浮QQ客服会始终固定在右侧</p>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
        $(document).ready(function() {
            // 鼠标移入显示二维码
            $(".float-qq-top").hover(function() {
                $(this).find(".float-qq-qrcode").stop().fadeIn(200);
            }, function() {
                $(this).find(".float-qq-qrcode").stop().fadeOut(200);
            });
            
            // QQ客服点击事件
            $(".float-qq-item").not(".float-qq-top").not(".float-qq-bottom").click(function() {
                var qqNum = $(this).find(".qq-num").text();
                window.open("http://wpa.qq.com/msgrd?v=3&uin=" + qqNum + "&site=qq&menu=yes", "_blank");
            });
            
            // 电话客服点击事件
            $(".float-qq-bottom").click(function() {
                var telNum = $(this).find(".qq-num").text();
                alert("拨打电话: " + telNum);
            });
        });
    </script>
</body>
</html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值