在线客服悬浮窗

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线客服悬浮窗</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Microsoft YaHei', sans-serif;
        }
        
        /* 客服主容器 */
        .online-service {
            position: fixed;
            right: 20px;
            bottom: 20px;
            z-index: 9999;
            transition: all 0.3s ease;
        }
        
        /* 客服按钮 */
        .service-btn {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #4e8cff, #2a5bd7);
            border-radius: 50%;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .service-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        }
        
        .service-btn i {
            color: white;
            font-size: 30px;
        }
        
        /* 客服面板 */
        .service-panel {
            position: absolute;
            right: 0;
            bottom: 70px;
            width: 280px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
            overflow: hidden;
            transform: scale(0);
            transform-origin: bottom right;
            opacity: 0;
            transition: all 0.3s ease;
        }
        
        .service-panel.active {
            transform: scale(1);
            opacity: 1;
        }
        
        /* 面板头部 */
        .panel-header {
            background: linear-gradient(135deg, #4e8cff, #2a5bd7);
            color: white;
            padding: 15px;
            text-align: center;
            position: relative;
        }
        
        .panel-header h3 {
            font-size: 18px;
            font-weight: normal;
        }
        
        .close-panel {
            position: absolute;
            right: 10px;
            top: 10px;
            cursor: pointer;
            font-size: 16px;
            opacity: 0.8;
        }
        
        .close-panel:hover {
            opacity: 1;
        }
        
        /* 面板内容 */
        .panel-content {
            padding: 15px;
        }
        
        .service-item {
            display: flex;
            align-items: center;
            padding: 10px;
            margin-bottom: 10px;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .service-item:hover {
            background: #f5f5f5;
        }
        
        .service-item i {
            width: 40px;
            height: 40px;
            background: #f0f0f0;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 10px;
            color: #4e8cff;
            font-size: 18px;
        }
        
        .service-item .item-info {
            flex: 1;
        }
        
        .service-item .item-title {
            font-size: 16px;
            color: #333;
            margin-bottom: 3px;
        }
        
        .service-item .item-desc {
            font-size: 12px;
            color: #999;
        }
        
        /* 工作时间 */
        .work-time {
            font-size: 12px;
            color: #999;
            text-align: center;
            padding: 10px 0;
            border-top: 1px solid #eee;
            margin-top: 10px;
        }
        
        /* 响应式调整 */
        @media (max-width: 768px) {
            .online-service {
                right: 10px;
                bottom: 10px;
            }
            
            .service-panel {
                width: 260px;
            }
        }
    </style>
</head>
<body>
    <!-- 在线客服容器 -->
    <div class="online-service">
        <!-- 客服面板 -->
        <div class="service-panel">
            <div class="panel-header">
                <h3>在线客服</h3>
                <div class="close-panel">×</div>
            </div>
            <div class="panel-content">
                <div class="service-item" data-type="qq">
                    <i>QQ</i>
                    <div class="item-info">
                        <div class="item-title">QQ客服</div>
                        <div class="item-desc">点击联系QQ在线客服</div>
                    </div>
                </div>
                <div class="service-item" data-type="wechat">
                    <i>微信</i>
                    <div class="item-info">
                        <div class="item-title">微信客服</div>
                        <div class="item-desc">扫码添加微信客服</div>
                    </div>
                </div>
                <div class="service-item" data-type="phone">
                    <i>电话</i>
                    <div class="item-info">
                        <div class="item-title">电话客服</div>
                        <div class="item-desc">400-123-4567</div>
                    </div>
                </div>
                <div class="work-time">
                    工作时间:周一至周五 9:00-18:00
                </div>
            </div>
        </div>
        
        <!-- 客服按钮 -->
        <div class="service-btn">
            <i>客服</i>
        </div>
    </div>

    <script>
        $(document).ready(function() {
            // 切换客服面板显示/隐藏
            $('.service-btn').click(function() {
                $('.service-panel').toggleClass('active');
            });
            
            // 关闭面板
            $('.close-panel').click(function(e) {
                e.stopPropagation();
                $('.service-panel').removeClass('active');
            });
            
            // 点击客服选项
            $('.service-item').click(function() {
                const type = $(this).data('type');
                let url = '';
                
                switch(type) {
                    case 'qq':
                        url = 'http://wpa.qq.com/msgrd?v=3&uin=12345678&site=qq&menu=yes';
                        window.open(url, '_blank');
                        break;
                    case 'wechat':
                        alert('请使用微信扫描二维码添加客服');
                        // 这里可以替换为实际的微信二维码图片
                        break;
                    case 'phone':
                        window.location.href = 'tel:4001234567';
                        break;
                }
                
                // 点击后关闭面板
                $('.service-panel').removeClass('active');
            });
            
            // 点击空白处关闭面板
            $(document).click(function(e) {
                if (!$(e.target).closest('.online-service').length) {
                    $('.service-panel').removeClass('active');
                }
            });
            

        });
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值