我彈出一個窗口進行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