弹出div或者弹出新窗口的固定位置、固定大小

js代码:

//打开一个新窗口,固定的位置,固定的大小
        //window.open("push_add.html",'newwindow', 'height=550, width=1000, top=200, left=500, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');


//弹出一个div

        var $box = $('.box');
        $box.css({
            //设置弹出层距离左边的位置
            left: ($("body").width() - $box.width()) / 2 - 20 + "px",
            //设置弹出层距离上面的位置
            top: ($(window).height() - $box.height()) / 2 + $(window).scrollTop() + "px",
            display: "block"
        });

你可能感兴趣的:(弹出框,跳转新窗口)