zoomla
Version:
16年专业研发|中文alexa排名第一的CMS品牌-基于dotNET core、功能强大,集成站群、微信开发、小程序与ERP及OA办公系统,支持国际语言和多民族语言,世界五百强与大型门户专用高端网站内核CMS系统
30 lines • 1.3 kB
JavaScript
//不同的主题,进行不同的实现即可
//多个聊天框实现多个对象即可,名字不同
var ZLChat = function () { };
ZLChat.prototype.Init = function () {
this.AddChatDiv();
this.AddCSS();
}
ZLChat.prototype.OpenChat = function () {
var config = $("#zlchat").data("option");
var url = "/Common/Chat/cs?CodeID="+config.id;
var iTop = (window.screen.availHeight - 30 - 300) / 2;
var iLeft = (window.screen.availWidth - 10 - 500) / 2;
window.open(url, "_chat", 'width=1024,height=768,top=' + iTop + ',left=' + iLeft + ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}
ZLChat.prototype.AddChatDiv = function () {
//添加Html至页面并绑定事件
var ref = this;
var tlp = $('<a href="javascript:;" style="position:fixed;right:10px;bottom:80px;z-index:10;" class="chat_help" title="点击咨询"><img src="/js/Plugs/Chat/help.png" /></a>');
tlp.click(function () { ref.OpenChat(); });
$("body").append(tlp);
}
ZLChat.prototype.AddCSS = function () {
//将css加至头部
//$("head").append('<link href="/js/Plugs/Chat/chat_def.css" rel="stylesheet" />');
}
ZLChat.prototype.EventBind = function () { };
$(function () {
var chat = new ZLChat();
chat.Init();
})