最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ShareThis not working on custom divs - Stack Overflow

programmeradmin0浏览0评论

I am using ShareThis two ways. The right hand side is using their built in buttons. I write some custom og at the top of the page so that it references this whole site as a whole and not just this individual blog. In the content of the post i have a Share This Post on Facebook.

<div data-network="facebook" data-url="">Share This Post on Facebook</div>

I am calling JS:

<script type="text/javascript" src="//platform-api.sharethis/js/sharethis.js#property=MYID&product=custom-share-buttons"></script>

From all I read the data-network="facebook" should trigger the share on the data-url. It is acting like nothing is happening at all. What am I missing in sharing custom buttons?

http://test.cota/campaigns/COTAforTimothyA/blog/Images-How-will-they-appear-just-to-rename

I am using ShareThis two ways. The right hand side is using their built in buttons. I write some custom og at the top of the page so that it references this whole site as a whole and not just this individual blog. In the content of the post i have a Share This Post on Facebook.

<div data-network="facebook" data-url="http://test.cota/campaigns/COTAforTimothyA/blog/Images-How-will-they-appear-just-to-rename">Share This Post on Facebook</div>

I am calling JS:

<script type="text/javascript" src="//platform-api.sharethis./js/sharethis.js#property=MYID&product=custom-share-buttons"></script>

From all I read the data-network="facebook" should trigger the share on the data-url. It is acting like nothing is happening at all. What am I missing in sharing custom buttons?

Share Improve this question asked Apr 17, 2017 at 20:12 jeynonjeynon 3227 silver badges16 bronze badges 1
  • Have you added the sharethis js on top of the page – Nouphal.M Commented Jun 19, 2017 at 8:30
Add a ment  | 

1 Answer 1

Reset to default 11

I figured out that the custom divs also need a class — st-custom-button — to make them work.

It doesn't actually say that anywhere, which is why I didn't do it, but I finally noticed it's in one of the examples on this page, so I thought I'd give it a try. And it works. >.<

发布评论

评论列表(0)

  1. 暂无评论