admin管理员组文章数量:1326321
I have a Div data which is ing dynamically. I want to open that div data in popup after some event fired. I am done with my code. But when popup is opening in my browser its not centered aligned.. Its ing in corner..
My code :-
var w = 620;
var h = 360;
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var divText = document.getElementById("inviteConfirmationMessage").outerHTML;
var myWindow = window.open('','','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
var doc = myWindow.document;
doc.open();
doc.write(divText);
doc.close();
Working in Mozilla firefox but not working in Chrome --
/
Please help me out !! or any guidance.
I have a Div data which is ing dynamically. I want to open that div data in popup after some event fired. I am done with my code. But when popup is opening in my browser its not centered aligned.. Its ing in corner..
My code :-
var w = 620;
var h = 360;
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var divText = document.getElementById("inviteConfirmationMessage").outerHTML;
var myWindow = window.open('','','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
var doc = myWindow.document;
doc.open();
doc.write(divText);
doc.close();
Working in Mozilla firefox but not working in Chrome --
http://jsfiddle/Wj3Qk/2/
Please help me out !! or any guidance.
Share Improve this question edited Sep 24, 2013 at 9:57 FrontEnd Expert asked Sep 24, 2013 at 9:07 FrontEnd ExpertFrontEnd Expert 5,81310 gold badges63 silver badges100 bronze badges 1- possible duplicate of How to center a popup window? – epascarello Commented Sep 24, 2013 at 9:16
2 Answers
Reset to default 4 var left = (window.screen.width / 2) - ((w / 2) + 10);
var top = (window.screen.height / 2) - ((h / 2) + 50);
window.open('','',
"status=no,height=" + height + ",width=" + width + ",resizable=yes,left="
+ left + ",top=" + top + ",screenX=" + left + ",screenY="
+ top + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
var myWindow = window.open('','','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
you are missing last quote in it.
Is should be like this :
var myWindow = window.open('','','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left+');
本文标签: javascriptWindowpopup in center align in browserStack Overflow
版权声明:本文标题:javascript - Window.popup in center align in browser - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742203318a2432358.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论