繁体   English   中英

ShareThis按钮在弹出窗口中打开

[英]ShareThis Button to Open in Popup

我正在使用Sharethis按钮进行社交媒体共享。 问题是当你点击Twitter,Facebook,Linkedin或任何其他按钮时,它会在新标签页中打开。 我希望它在弹出窗口中打开。 这可能吗? 这是我正在使用的代码。

这是在头部

    <script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-3a946ea7-4e9c-2bf6-f820-37c233b1bc9c", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

这是在页面的主体。

<span class='st_sharethis_large' displayText='ShareThis'></span>
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_linkedin_large' displayText='LinkedIn'></span>
<span class='st_pinterest_large' displayText='Pinterest'></span>
<span class='st_email_large' displayText='Email'></span>

这也不起作用。

<script type="text/javascript">var switchTo5x=true;</ script>
<script type="text/javascript" src=" w.sharethis.com/button/buttons.js"></ script> 
<script type="text/ javascript">
  stLight.options({
    publisher: "ur-3a946ea7-4e9c-2bf6- f820-37c233b1bc9c", 
    popup: 'true' 
    doNotHash: false, 
    doNotCopy: false, 
    hashAddressBar: false
 });
 </script>

除了popup选项之外,您还需要在调用stLight.options()时将servicePopup选项设置为true

<script charset="utf-8" type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script charset="utf-8" type="text/javascript">
    stLight.options({
        "publisher":"####",
        "doNotCopy":false,
        "hashAddressBar":false,
        "doNotHash":false,
        "servicePopup":true
    });
</script>

我使用ShareThis插件使用此脚本,其中:

"servicePopup":true

问题是你正在使用的button.js插件..如果你有一个链接,你可以指定WHERE来打开它,或者用JS

window.open("www.youraddress.com","_self")

但是,由于您使用的是预制插件,因此无法更改。

您可以创建自己的脚本,以便在类点击时打开特定页面

$('.stack').click(function(){
    window.location = 'www.stackoverflow.com';
});

编辑:或者从问题的评论中可以看出,该插件支持选项标志。 我的坏,还没检查过。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM