码迷,mamicode.com
首页 > 其他好文 > 详细

pop

时间:2014-12-29 00:53:21      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

    var draw = function() {
        //
        var time = new Date().getTime();
        mWindow = lw.create(‘div‘);
        document.body.appendChild(mWindow);
        mWindow.style.display = ‘none‘;
        var windowId = ‘lwWindow_‘ + time;
        mWindow.setAttribute(‘id‘, windowId);
        mWindow.setAttribute(‘class‘, ‘lwWindow‘);
        mWindow.style.width = document.body.scrollWidth + ‘px‘;
        mWindow.style.height = document.body.scrollHeight + ‘px‘;
        mDialog = lw.create(‘div‘);
        document.body.appendChild(mDialog);
        mDialog.style.display = ‘none‘;
        var dialogId = ‘lwDialog_‘ + time;
        mDialog.setAttribute(‘id‘, dialogId);
        mDialog.setAttribute(‘class‘, ‘lwDialog‘);
        mDialog.style.width = mWidth + ‘px‘;
        mDialog.style.height = mHeight + ‘px‘;
        var pageWidth = Math.min(window.screen.availWidth, document.body.clientWidth);
        var pageHeight = Math.min(window.screen.availHeight, document.body.clientHeight);
        var top = document.documentElement.scrollTop - 100 + (pageHeight - mHeight) / 2;
        var left = document.documentElement.scrollLeft + (pageWidth - mWidth) / 2;
        if (top < 0) {
            top = 100;
        }
        if (left < 0) {
            left = 100;
        }
        mDialog.style.top = top + ‘px‘;
        mDialog.style.left = left + ‘px‘;
        //
        ...
    }

 

.lwWindow {
    position: absolute;
    left: 0px;
    top: 0px;
    margin: 0;
    padding: 0;
    background-color: gainsboro;
    filter: alpha(opacity = 50);
    -moz-opacity: 0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
}

.lwDialog {
    position: absolute;
    overflow: hidden;
    border: 2px solid lightblue;
    background-color: white;
}

 

pop

标签:

原文地址:http://www.cnblogs.com/linkwork/p/4190864.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!