<i id='cajjl'><tr id='cajjl'><dt id='cajjl'><q id='cajjl'><span id='cajjl'><b id='cajjl'><form id='cajjl'><ins id='cajjl'></ins><ul id='cajjl'></ul><sub id='cajjl'></sub></form><legend id='cajjl'></legend><bdo id='cajjl'><pre id='cajjl'><center id='cajjl'></center></pre></bdo></b><th id='cajjl'></th></span></q></dt></tr></i><div id='cajjl'><tfoot id='cajjl'></tfoot><dl id='cajjl'><fieldset id='cajjl'></fieldset></dl></div>

  1. <small id='cajjl'></small><noframes id='cajjl'>

    <tfoot id='cajjl'></tfoot>
      <bdo id='cajjl'></bdo><ul id='cajjl'></ul>
    1. <legend id='cajjl'><style id='cajjl'><dir id='cajjl'><q id='cajjl'></q></dir></style></legend>
    2. 在屏幕中心启动 Facebook 分享弹出窗口

      Launch Facebook Share Popup at Center of Screen(在屏幕中心启动 Facebook 分享弹出窗口)
      <i id='SGYWX'><tr id='SGYWX'><dt id='SGYWX'><q id='SGYWX'><span id='SGYWX'><b id='SGYWX'><form id='SGYWX'><ins id='SGYWX'></ins><ul id='SGYWX'></ul><sub id='SGYWX'></sub></form><legend id='SGYWX'></legend><bdo id='SGYWX'><pre id='SGYWX'><center id='SGYWX'></center></pre></bdo></b><th id='SGYWX'></th></span></q></dt></tr></i><div id='SGYWX'><tfoot id='SGYWX'></tfoot><dl id='SGYWX'><fieldset id='SGYWX'></fieldset></dl></div>
          <bdo id='SGYWX'></bdo><ul id='SGYWX'></ul>
          <legend id='SGYWX'><style id='SGYWX'><dir id='SGYWX'><q id='SGYWX'></q></dir></style></legend>
        • <small id='SGYWX'></small><noframes id='SGYWX'>

            <tfoot id='SGYWX'></tfoot>
                <tbody id='SGYWX'></tbody>
                本文介绍了在屏幕中心启动 Facebook 分享弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                The following code works well and launches a facebook popup on the screen, however this popup is not centered.

                <script type="text/javascript">
                function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
                

                <a href="http://www.facebook.com/share.php?u=<full page url to share" onClick="return fbs_click()" target="_blank" title="Share This on Facebook"><img src="images/facebookimage.jpg" alt="facebook share"></a>
                

                Here is the script that centers a popup window:

                    <script type="text/javascript">
                 function MyPopUpWin(url, width, height) {
                    var leftPosition, topPosition;
                    //Allow for borders.
                    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
                    //Allow for title and status bars.
                    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
                    //Open the window.
                    window.open(url, "Window2",
                    "status=no,height=" + height + ",width=" + width + ",resizable=yes,left="
                    + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY="
                    + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
                }
                </script>
                

                Can someone please update the 1st script so that it works in combination with the 2nd script to result in the popup window launching in the center of the screen. (As my experience with coding is very limited i know not how to do this.) Thanks heaps. Pia

                解决方案

                See if this works for you:

                <script type="text/javascript">
                function fbs_click(width, height) {
                    var leftPosition, topPosition;
                    //Allow for borders.
                    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
                    //Allow for title and status bars.
                    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
                    var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
                    u=location.href;
                    t=document.title;
                    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer', windowFeatures);
                    return false;
                }
                </script>
                
                <!-- Please change the width and height to suit your needs -->
                <a href="http://www.facebook.com/share.php?u=<full page url to share" onClick="return fbs_click(400, 300)" target="_blank" title="Share This on Facebook"><img src="images/facebookimage.jpg" alt="facebook share"></a>
                

                这篇关于在屏幕中心启动 Facebook 分享弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))

                <small id='hiJZJ'></small><noframes id='hiJZJ'>

                  <tbody id='hiJZJ'></tbody>

                    <i id='hiJZJ'><tr id='hiJZJ'><dt id='hiJZJ'><q id='hiJZJ'><span id='hiJZJ'><b id='hiJZJ'><form id='hiJZJ'><ins id='hiJZJ'></ins><ul id='hiJZJ'></ul><sub id='hiJZJ'></sub></form><legend id='hiJZJ'></legend><bdo id='hiJZJ'><pre id='hiJZJ'><center id='hiJZJ'></center></pre></bdo></b><th id='hiJZJ'></th></span></q></dt></tr></i><div id='hiJZJ'><tfoot id='hiJZJ'></tfoot><dl id='hiJZJ'><fieldset id='hiJZJ'></fieldset></dl></div>
                    • <bdo id='hiJZJ'></bdo><ul id='hiJZJ'></ul>
                    • <legend id='hiJZJ'><style id='hiJZJ'><dir id='hiJZJ'><q id='hiJZJ'></q></dir></style></legend>
                        <tfoot id='hiJZJ'></tfoot>