红穆笔记
首頁 踩坑總結 網站側邊客服代碼 摺疊式 圓球客服展示
踩坑總結

網站側邊客服代碼 摺疊式 圓球客服展示

网站侧边客服代码 折叠式 圆球客服展示

首先是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需要自己去引入或者查找對應的圖標

微信赞赏

微信

支付宝赞赏

支付寶

✍️ 作者: 紅穆

網站管理員 · 感謝閱讀,更多精彩內容敬請關注

作者主頁 查看主頁 →

相關文章

浏览器缓存增加你网站二次访问速度

瀏覽器緩存增加你網站二次訪問速度 踩坑總結

使用瀏覽器緩存官方話語:如果用戶會多次訪問您的網站,那麼靜態資源的瀏覽器緩存可以節省用戶的時間。緩存標頭應當應用到所有可緩存的靜態資源中,而不僅僅是應用到一小部分靜態資源(例如,圖片)中。可緩存的資源包括JS和CSS文件、圖像文件及其他二進制對象文件(媒體文件和PDF文件等)。通常情況下,HTML不…
👁 202
常用正则表达式

常用正則表達式 踩坑總結

正則表達式網址(URL)[a-zA-z]+://[^\s]*IP地址(IP Address)((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)電子郵件(Email)\w+([-+.]\w+)*@\w+([-.]\w+)*…
👁 243

推薦閱讀

环保新材料新能源类回收网站模板 0731

環保新材料新能源類回收網站模板 0731 實用收藏 易優模板

此套eyoucms模板適用於環保新材料與新能源回收類企業,設計風格綠色科技,能夠展示新型環保材料、能源回收技術及產品。有助於環保企業在線上樹立綠色品牌形象,吸引合作客戶。模板展示 安裝說明 網站後臺:/login.php 賬號:admin 密碼:admin 相關文章易優CMS安裝常見問題總結易優CM…
👁 50
响应式废气处理环保设备网站模板 0732

響應式廢氣處理環保設備網站模板 0732 實用收藏 易優模板

一款針對廢氣處理環保設備類企業的eyoucms響應式網站模板。設計風格科技環保,能夠展示廢氣處理設備、技術方案及工程案例。有助於環保工程公司在線上展示解決方案,吸引工業與市政客戶。模板展示 安裝說明 網站後臺:/login.php 賬號:admin 密碼:admin 相關文章易優CMS安裝常見問題總…
👁 35
环境水务治理网站模板 0733

環境水務治理網站模板 0733 實用收藏 易優模板

此套eyoucms模板適用於環境水務治理行業,設計風格專業環保,能夠展示水處理工程、水務治理項目及技術方案。有助於環保水務企業在線上展示實力,吸引政府與企業客戶。模板展示 安裝說明 網站後臺:/login.php 賬號:admin 密碼:admin 相關文章易優CMS安裝常見問題總結易優CMS(Ey…
👁 49
资源网站typecho001模板

資源網站typecho001模板 程序筆記 Typecho

typecho001模板板本請勿修改本模板文件夾名稱 文件夾名稱爲:typecho001 1.4修復文章頁面js輸出問題1.3修復未安裝插件時的報錯提示優化列表頁代碼輸出1.2修復評論功能增加自定義首頁標題1.1修復評論回覆不對稱功能添加首頁單獨的標題設置功能增加網站favicon.ico圖標增加一…
👁 198
营销型塑料板材净化环保设备网站模板 0734

營銷型塑料板材淨化環保設備網站模板 0734 實用收藏 易優模板

一款針對營銷型塑料板材與淨化環保設備企業的eyoucms網站模板。設計風格綠色環保,能夠展示塑料板材產品、淨化設備及技術方案。有助於環保材料企業在線上展示產品,吸引工業客戶。模板展示 安裝說明 網站後臺:/login.php 賬號:admin 密碼:admin 相關文章易優CMS安裝常見問題總結易優…
👁 47
typecho分页样式的修改

typecho分頁樣式的修改 程序筆記 Typecho

大人,時代變了!目前typecho最完美的解決方案了,因爲百度只能看到固定思維的代碼。實際生成的html代碼,乾淨到讓人窒息完全的自定義,包括給li元素加上class,給a元素加上class,給上一頁下一頁加上class,去除typecho自帶用於表示更多的li標籤。甚至裏面的內容我也能添加一些文字…
👁 517