开发者

Chrome Javascript popup on dual monitors is off

开发者 https://www.devze.com 2023-02-13 23:55 出处:网络
I\'m trying to open a javascript popup that is centered based on where the current window is. I have dual monitor setup and it works in every other browser b开发者_如何学编程ut chrome. For some reason

I'm trying to open a javascript popup that is centered based on where the current window is. I have dual monitor setup and it works in every other browser b开发者_如何学编程ut chrome. For some reason when chrome is on my 2nd monitor the popup is way to the right.

var winX = (document.all) ? window.screenLeft : window.screenX;
var winY = (document.all) ? window.screenTop : window.screenY;

var newWindowWidth = 650;
var newWindowHeight = 700;

var currentWindowWidth = $(window).width();
var currentWindowHeight = $(window).height();

var newWindowX = (winX + (currentWindowWidth / 2)) - (newWindowWidth / 2);
var newWindowY = (winY + (currentWindowHeight / 2)) - (newWindowHeight / 2);

window.open("", "configurationWindow", "scrollbars=1,resizable=yes,width=" + newWindowWidth + ",height=" + newWindowHeight + ",top=" + newWindowY + ",left=" + newWindowX);


This is a known Chrome bug, id #73353. If you have a Google account you can star it to keep track of its status.

0

精彩评论

暂无评论...
验证码 换一张
取 消