CI框架,双层弹出框的样式实现

时间:2023-03-09 01:29:43
CI框架,双层弹出框的样式实现

在弹出的主页面上,写一个隐藏的悬浮的div 通过标记使他显示,通过计数器使他关闭

部分代码:

<div id="common_msg"></div>//主页面
            showMsg(data.msg);//调用
            //弹出提示框
            var timeout1 = setTimeout(function() {}, 10);
            function showMsg(text) {
            clearTimeout(timeout1);
                var common_msg = $("#common_msg");
                common_msg.html(text);
                common_msg.css("display", "block");
                common_msg.css("left", (winSize().width / 2 - common_msg.width() / 2) + "px");
                common_msg.css("top", (winSize().height / 2 - common_msg.height() / 2) + "px");
                timeout1 = setTimeout(function() {
                common_msg.css("display", "none");
                }, 3000);
            }
            //获取浏览器可视区域宽高
            function winSize() {
                var e = window, a = 'inner';
                if (!('innerWidth' in window)) {
                    a = 'client';
                    e = document.documentElement || document.body;
                }
                return {width: e[ a + 'Width' ], height: e[ a + 'Height' ]};
            }