popup = window.open(thelink,'Facebook Share','resizable=1,status=0,location=0,
width=500,height=300');

我想将此窗口一直移动到中心(垂直和水平)

最佳答案

奥瓦拉

我从Google搜索中直接得到了这种简单的javascript,我们可以用简单得多的方式在jquery中进行操作,但尝试这样的操作

var myWindow;

function openCenteredWindow(url) {
    var width = 400;
    var height = 300;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, "subWind", windowFeatures);
}

10-04 22:39
查看更多