- <script>
- //连接自己修改
- var chats =[
- "####"
- ];
- var index = Math.floor((Math.random()*chats.length));;
- var chatUrl =chats[index];
- var chat =function(){
- //window.location.href = chatUrl;
- openChatWin();
- };
- //3秒后跳转到 连接 3000 3秒 5000 5秒 8000 8秒
- //setTimeout(function(){
- // openChatWin();
- //}, 600000);
-
- </script>
复制代码
- <script>
- $(function(){
- var html_ ='<iframe src="'+chatUrl+'" style="width:100%;height:100%;" id="iframe" frameborder="0"></iframe>'
- $("#iframeChat").html(html_);
- });
- //根据自适应 设置弹出层宽度
- var getWindow = function () {
- var width = $(document.body).width();
- if(width<750){
- return false;
- }else{
- return true;
- }
- };
- var indexlayer =null;
- var openChatWin =function(){
- if(indexlayer!=null){
- $(".layui-layer").slideDown("slow")
- $("html").css("overflow","hidden");
- }else{
- indexlayer = layer.open({
- title:'客服在线为您服务',
- type: 1,
- anim: 2,
- shade: false,
- area: ['1000px','800px'],
- maxmin: false,
- content: $("#iframeChat"),
- zIndex: layer.zIndex, //重点1
- closeBtn: 1,
- btn: ['关闭聊天窗口',] ,
- yes: function(index, layero){
- //$(".layui-layer").hide(500);
- $(".layui-layer").slideUp("fetch");
- $("html").css("overflow","auto");
- },
- cancel: function(){
- //$(".layui-layer").hide(500);
- $(".layui-layer").slideUp("fetch");
- $("html").css("overflow","auto");
- return false;
- }
- });
- layer.full(indexlayer);
- }
- }
- </script>
复制代码 |