我弹出一个窗口进行Facebook身份验证,我希望该页面的内容以弹出窗口为中心。我是不是询问如何将弹出窗口居中在屏幕上。我在问如何将页面居中在弹出窗口中。 Javascript是好的。使弹出窗口为中心
<a href="/auth/facebook" id="facebook_button" data-width="800" data-height="400">
<script>
$("#facebook_button").click(ask_for_facebook_auth);
function popupCenter(url, width, height, name) {
var left = (screen.width/2)-(width/2);
var top = (screen.height/2)-(height/2);
return window.open(url, name, "menubar=no,toolbar=no,status=no,width="+width+",height="+height+",toolbar=no,left="+left+",top="+top);
}
function ask_for_facebook_auth(e){
popupCenter($(this).attr("href"), $(this).attr("data-width"), $(this).attr("data-height"), "authPopup");
e.stopPropagation(); return false;
}
</script>
如何分享弹出窗口中涉及的某些标记,以便我们不必猜测您拥有什么。 – Gabe 2012-02-07 02:21:44
有时候人们只是懒惰。好的问题需要好的答案... – elclanrs 2012-02-07 02:26:58
对不起,我添加了它。 – stackOverlord 2012-02-07 02:34:26