Reputation: 93
I am using Sharethis button for social media sharing. The problem is that when you click on Twitter, Facebook, Linkedin or any other button, it open in new tab. I want it to open in popup window. Is that possible to do. Here is the code I am using.
This goes in head section
<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>
And this goes in the body of the page.
<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>
This did not work either.
<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>
Upvotes: 2
Views: 4728
Reputation: 41
<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>
I got this script working with ShareThis plugin, with:
"servicePopup":true
Upvotes: 4
Reputation: 996
Besides the popup
option, you'll want to set the servicePopup
option to true
when calling stLight.options()
.
Upvotes: 12
Reputation: 2321
The problem is the button.js plugin that you are using.. If you had a link you could specify WHERE to open it, or with JS
window.open("www.youraddress.com","_self")
But since you're using a pre-made plugin you can't change that.
You could create your own script to open a specific page on class click with something like
$('.stack').click(function(){
window.location = 'www.stackoverflow.com';
});
EDIT: Or as you can see from the comment on the question, that plugin supports option flags. My bad, haven't checked it.
Upvotes: 0