试图使弹出框居中显示任何屏幕分辨率


Trying to centre a popupbox for any screen resolution

对于任何屏幕分辨率,我如何使弹出框出现在屏幕中心?弹出框使用joomla弹出框插件(内容简单弹出)显示。请帮忙。谢谢

您能提供一个链接到您正在实现的站点吗?如果它的弹出窗口,你也可以使用它。

function PopupCenter(pageURL, title,w,h) {
        var left = (screen.width/2)-(w/2);
        var top = (screen.height/2)-(h/2);
        var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
        } 

我使用jQuery将任何元素制作为弹出框,您可以访问我的github存储库以获取详细信息完整的弹出框,并附上示例或者,您也可以使用我的ripo作为cdn,只需复制这个原始git并粘贴到ur脚本标记