layui.use(['layer', 'element'], function() { var element = layui.element, layer = layui.layer; //获得layer模块 var index; //会话窗口 $('#service').on('click', function() { index = layer.open({ type: 1, content: $('.service'), title: '客服服务', area: ['800px', '520px'], anim: 1, resize: false, shade: 0 }) //移除小图标 $(this).find('sup').remove(); //移除动画 $(this).find('i').removeClass('layui-anim layui-anim-scaleSpring layui-anim-loop'); }) //关闭会话窗口 $('.closWin').on('click', function() { layer.close(index); }) //发送消息 $('.sendNews').on('click', function() { chatNews(); }) //回车发送 $('.service').keypress(function(event) { var e = event || window.event; if(e.keyCode == 13) { chatNews() return; } }) //聊天信息 function chatNews() { var txt = $('.layim-chat-textarea textarea').val(); if(txt == '') { layer.msg('发送内容不能为空!'); } else { //发送内容 alert(123); } } //通知项 $('#news').on('click',function () { layer.open({ type:1, title:'通知公告', content:$('.newsTips'), area:['300px', '500px'], offset :'rb', anim: 2, shade:0, resize:false }) //移除小图标 $(this).find('sup').remove(); }) //通知项点击打开新的标签页 $('.newsTips .newsBox li').on('click',function () { var str = $('我是通知'); addTab(str); }) });