Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 共享此按钮以在弹出窗口中打开_Javascript_Jquery_Facebook_Sharethis - Fatal编程技术网

Javascript 共享此按钮以在弹出窗口中打开

Javascript 共享此按钮以在弹出窗口中打开,javascript,jquery,facebook,sharethis,Javascript,Jquery,Facebook,Sharethis,我正在使用Sharethis按钮进行社交媒体共享。问题是,当你点击Twitter、Facebook、Linkedin或任何其他按钮时,它会在新标签中打开。我希望它在弹出窗口中打开。这可能吗。这是我正在使用的代码 这个在头部 <script type="text/javascript">var switchTo5x=true;</script> <script type="text/javascript" src="http://w.sharethis.com

我正在使用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>
var switchTo5x=true;
选项({发布者:“ur-3a946ea7-4e9c-2bf6-f820-37c233b1bc9c”,doNotHash:false,doNotCopy:false,hashAddressBar:false});
这会出现在页面的主体中

<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>
var switchTo5x=true;
stLight.options({
出版商:“ur-3a946ea7-4e9c-2bf6-f820-37c233b1bc9c”,
弹出:“true”
多诺塔什:错,
不要抄袭:错,
hashAddressBar:false
});

问题在于您正在使用的button.js插件。。 如果你有一个链接,你可以指定在哪里打开它,或者使用JS

window.open("www.youraddress.com","_self")
但是因为你使用的是一个预先制作好的插件,所以你不能改变它

您可以创建自己的脚本,在类上打开特定的页面,单击类似

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

编辑:或者你可以从问题的评论中看到,该插件支持选项标志。我的坏消息,没有检查。

除了
弹出
选项外,调用
stLight.options()

时,您还需要将
servicepoppopup
选项设置为
true
。RTM:我尝试了这个不起作用的代码。请告诉我做错了什么。var switchTo5x=真;选项({发布者:“ur-3a946ea7-4e9c-2bf6-f820-37c233b1bc9c”,弹出:“true”doNotHash:false,doNotCopy:false,hashAddressBar:false});您肯定忘了在
true,
之后加上逗号,应该是
popup:true
,而不是
popup:true'
,谢谢您的回复。我试过了,但没用。我把头部代码改成了这个。请看看我做错了什么var switchTo5x=真;w、 sharethis.com/button/buttons.js“>stLight.options({发布者:“ur-3a946ea7-4e9c-2bf6-f820-37c233b1bc9c”,弹出窗口:“true”doNotHash:false,doNotCopy:false,hashAddressBar:false});'
<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>
"servicePopup":true