懸浮在網站上的微信在線客服如何實現
作者:快商通發布時間:2020年08月06日閱讀量:
摘要:
通過快商通在線客服系統的后臺配置,為網站添加在線客服的分組圖標,根據需求設置自己的微信二維碼,就可以實現將在線客服的功能組件懸浮在網站上的效果,鼠標觸摸微信圖標可以自動彈出微信二維碼。

網站在線客服系統
網站上的微信在線客服是什么
經常能夠在他人網站上看到右側浮動的在線客服系統,其中就包含有“微信咨詢”的相關按鈕,觸摸或點擊的時候會自動彈出企業的二維碼,非常方便。也可以點擊旁邊的在線咨詢,可以直接跟客服人員進行對話。這種效果是目前大公司想要做微信營銷主流的頁面展示方式。

網站上的微信在線客服
懸浮在網站上的微信在線客服如何實現
1、打開快商通,找到【設置中心】-【生成代碼】,點擊進入后選擇【圖標設置】,點擊【分組圖標】進入浮動在線客服功能組件的設置界面。

在線客服圖標設置
在圖標外觀下面選擇自定義樣式,在彈出的【定制代碼】內容框中加入自己想要定制化的代碼就可以了。

自定義在線客服樣式
如果不會寫代碼沒關系,這邊分享一下快商通官網的在線客服代碼,先復制粘貼出來,Ctrl+f搜索“微信咨詢”,找到微信二維碼的圖片地址,秀改成你自己的公眾號二維碼就可以了(文章底部分享完整代碼)。

替換代碼中的微信公眾號二維碼
當然,除了微信咨詢的其他功能組件的鏈接地址也要一并修改,調整完以后再復制進【定制代碼】欄中,點擊保存就可以了。

保存圖標樣式
懸浮在網站上的微信在線客服代碼分享
下載快商通后找到【設置中心】-【生成代碼】,點擊進入后依次選擇:【圖標設置】-【分組圖標】-【圖標外觀】-【自定義樣式】,將下面的代碼調整后復制到【定制代碼】內容框中就可以了。
以下是完整代碼:
{
//關閉區域(對象)的id值
g_close: '',
//頂端-html代碼
g_top: function() {
var g_id = KS.$(KS.grouping2IconId);
var ksscrollToTop = KS.$(KS.ksscrollToTop);
window.onscroll= function(){
var t = document.documentElement.scrollTop||document.body.scrollTop;
var ksscrollToTop = document.getElementById('ksscrollToTop');
if(t>0){
ksscrollToTop.style.display="block";
}else{
ksscrollToTop.style.display="none";
}
}
this.g_scrollToTop();
var _html = [];
_html.push('<a style="position:relative;display:block; width:70px; height:75px;font-size:13px;letter-spacing: 0; color:#fff;background:#05CCB7; text-align:center;text-decoration:none;border-top-left-radius: 2px;border-top-right-radius: 2px;" onmouseover="this.style.background=\'#05BEB4\';" onmouseout="this.style.background=\'#05CCB7\';" href="https://test.kuaishang.cn/bs/im.htm?cas=1061___168168&fi=1136" title="在線咨詢" target="_blank" rel="nofollow"><img style="margin-top:15px;margin-bottom:4px;" src="//www.jie-heng.com.cn/cusimg/ks_fz_before_20200221.png" border="0"/><div>在線咨詢</div><img style="position:absolute;left:3px;bottom:0;" src="//www.jie-heng.com.cn/cusimg/ks_fz_line_20200221.png" border="0"/></a>');
_html.push('<a style="position:relative;display:block; width:70px; height:74px;font-size:13px;letter-spacing: 0; color:#fff;background:#05CCB7; text-align:center;text-decoration:none;cursor:pointer;" onmouseover="this.style.background=\'#05BEB4\';document.getElementById(\'kswechat_code\').style.display=\'block\';" onmouseout="this.style.background=\'#05CCB7\';document.getElementById(\'kswechat_code\').style.display=\'none\';" title="微信咨詢" rel="nofollow"><img style="margin-top:13px;margin-bottom:4px;"
src="//www.jie-heng.com.cn/cusimg/ks_fz_wechat_20200229.png" border="0"/><div>微信咨詢</div><img style="position:absolute;left:3px;bottom:0;" src="//www.jie-heng.com.cn/cusimg/ks_fz_line_20200221.png" border="0"/></a>');
_html.push('<div style="position: relative; display: block; width: 70px; height: 74px; font-size: 13px; letter-spacing: 0px; color: rgb(255, 255, 255); background: rgb(5, 204, 183); text-align: center; text-decoration: none;overflow: hidden;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;transition:all .5s ease;" onmouseover="this.style.overflow=\'\';" onmouseout="this.style.overflow=\'hidden\';"><img style="position:absolute;right:3px;bottom:0;" src="//www.jie-heng.com.cn/cusimg/ks_fz_line_20200221.png" border="0"><div style="width:300px;height:73px;float:right;background:#05CCB7;margin-right:-230px;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;transition:all .5s ease;position: absolute;z-index:1;right:0;top:0;" onmouseover="this.style.marginRight=\'0\';" onmouseout="this.style.marginRight=\'-230px\';"><div style="width:70px;height:73px;float:left;text-align:center;color:#fff;font-weight:300;line-height:1;overflow:hidden;"><img style="margin-top:13px;margin-bottom:4px;" src="//www.jie-heng.com.cn/cusimg/ks_fz_phone_20200221.png" border="0"><div>電話咨詢</div></div><div style="width:230px;height:73px;float:left;"><div style="width: 220px;height:34px;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;margin-top: 20px;overflow:hidden;"><form name="f" id="f" method="post" action="https://tel.kuaishang.cn/calld.php" target="aa"><input type="hidden" name="fromurl" id="call_fromurl" value="http://www.jie-heng.com.cn/mianfeidianhua.html"><input type="hidden" name="sid" value="26"><input type="hidden" name="did" value="199"><input style="display:block;width: 140px;padding:0 10px;height:34px;float:left;color:#a4a4a4;border:none;outline:0;font-size: 12px;font-weight:300;box-sizing: border-box;" name="tel" type="text" id="tel" value="輸入電話即可免費通話" onclick="this.value=\'\'" onblur="if (value ==\'\'){value=\'輸入電話即可免費通話\'}"><input style="display:block;width: 80px;height:34px;float:right;padding: 0;line-height:34px;text-align:center;background-color:#ff9c01;color:#fff;border:none;outline:0;font-size: 13px;font-weight:300;box-sizing: border-box;cursor:pointer;" name="Submit" type="submit" id="callBtn" value="立即回電"><iframe name="aa" frameborder="0" width="0" height="0" style="display: none"></iframe></form></div></div></div></div>');
_html.push('<a style="position:relative;display:block; width:70px; height:75px;font-size:13px;letter-spacing: 0; color:#fff;background:#05CCB7; text-align:center;text-decoration:none;" onmouseover="this.style.background=\'#05BEB4\';" onmouseout="this.style.background=\'#05CCB7\';" href="https://kuaishang.cn/reg.html?refer=demo" title="體驗DEMO" target="_blank" rel="nofollow"><img style="margin-top:14px;margin-bottom:4px;" src="//www.jie-heng.com.cn/cusimg/ks_fz_demo_20200221.png" border="0"/><div>體驗DEMO</div><img style="position:absolute;left:3px;bottom:0;" src="//www.jie-heng.com.cn/cusimg/ks_fz_line_20200221.png" border="0"/></a>');
_html.push('<a style="position:relative;display:block; width:70px; height:75px;font-size:13px;letter-spacing: 0; color:#fff;background:#ff9c01; text-align:center;text-decoration:none;" onmouseover="this.style.background=\'#ef9405\';" onmouseout="this.style.background=\'#ff9c01\';" href="https://kuaishang.cn/reg.html?refer=rightFloatingBox" title="使用免費版" target="_blank" rel="nofollow"><img style="margin-top:14px;margin-bottom:4px;" src="//www.jie-heng.com.cn/cusimg/ks_fz_free_20200221.png" border="0"/><div>使用免費版</div></a>');
_html.push('<a id="ksscrollToTop" style="position:relative;display:none; width:70px; height:48px;font-size:13px;letter-spacing: 0; color:#fff;background:#dedfdf; text-align:center;text-decoration:none;cursor:pointer;" onmouseover="this.style.background=\'#eaeaea\';" onmouseout="this.style.background=\'#dedfdf\';" onclick="window.scrollTo(0,0)" target="_blank"><img style="position:absolute;left:22px;top:16px;" src="//www.jie-heng.com.cn/cusimg/ks_fz_top_20200221.png" border="0"/></a>');
_html.push('<div id="kswechat_code" style="position:absolute;display:none; width:207px; height:290px;font-size:13px;letter-spacing: 0; color:#fff;background:url(//www.jie-heng.com.cn/cusimg/icon_wechat_nosem.png); text-align:center;top:50%;right:74px;margin-top:-146px;"></div>');
return _html.join('');
},
g_scrollToTop: function() {
var t = document.documentElement.scrollTop||document.body.scrollTop;
setTimeout(function() {
var ksscrollToTop = document.getElementById('ksscrollToTop');
if(t>0){
ksscrollToTop.style.display="block";
}else{
ksscrollToTop.style.display="none";
}
}, 100);
},
//部門客服內容頭
g_cotent_top: '',
/**部門列表-html代碼
* @_id 部門ID
* @_name 部門名稱
* @_status 部門狀態
* @_hasCs 是否有需要顯示的客服
*/
g_dpt_list: function(_id, _name, _status, _hasCs) {
return '';
},
/**客服列表-html代碼
* @_id 客服ID
* @_name 客服名稱
* @_status 客服狀態
*/
g_cust_list: function(_id, _name, _status) {
return '';
},
/**部門客服內尾部-html代碼*/
g_cotent_but: '</div></div>',
/**中間按鈕列表-html代碼*/
g_mid: function() {
return '';
},
/**底部-html代碼*/
g_but: function() {
return '';
},
/**浮動*/
g_float: function() {
var f_v = {
_HAlign: 'right',
//放在左邊-left 右邊-right 中間-center
_VAlign: 'middle',
//放在底部-bottom 頂部-top 居中-middle
_HSize: 10,
//水平偏移位置 如上面是 right 則表示距離右邊距50px
_VSize: 0,
//垂直偏移位置 如上面是 bottom 則表示距離底部邊距50px
_zIndex: 888 //層顯示優先級,越大顯示時越靠前端--可能會被優先級大于該值的層覆蓋
};
return f_v;
}
}
總結:
以上是關于懸浮在網站上的微信在線客服的實現方式,總體來說不算特別難,不需要的功能組件也可以自己剔除,有一定html代碼基礎的站長都能輕松搞定。