显示多个推特分享按钮
Showing multiple twitter share buttons?
在我的网站的某个页面上,用户有一个项目列表,如下所示:
<div id="item1">.....</div>
<div id="item2">.....</div>
<div id="item3">.....</div>
这些div中的每一个在我的网站上都有一个自己的特殊链接,例如:
example.com/items/1
example.com/items/2
example.com/items/3
我想在每个单独的div中显示一个Twitter共享按钮,单击该按钮时,将允许用户将该特定项目的URL推到他们的Twitter上。
有没有插件可以做到这一点?
不需要第三方插件。使用Twitter插件:
<!DOCTYPE html>
<html lang="de">
<head>
<!-- meta -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<title>Twitter Share Buttons</title>
</head>
<body>
<div id="item1"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://example.com/items/1" data-text="Text to share 1">Tweet</a></div>
<div id="item2"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://example.com/items/2" data-text="Text to share 2">Tweet</a></div>
<div id="item3"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://example.com/items/3" data-text="Text to share 3">Tweet</a></div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</body>
</html>
相关文章:
- 社交分享按钮呈现错误
- 显示多个推特分享按钮
- 点击Facebook上的分享按钮后重定向
- 阻止推特分享按钮加载不正确
- Blogger上的Tumblr自定义分享按钮 - 打开弹出窗口
- 动态脸书分享按钮
- Facebook分享按钮没有显示
- Twitter分享按钮与JavaScript测验
- 如何在iframe中加载谷歌加分享按钮
- 通过jQuery的动态Facebook分享按钮
- 推特分享按钮动态网址分享
- 推特“推文分享”按钮不起作用
- 无法通过 Javascript 加载 Twitter 分享按钮
- 微信分享按钮
- 社交分享按钮,如CNET
- 谷歌社交互动分析与汤博乐分享按钮
- 领英分享按钮没有抓取图片或内容进行分享
- 社交分享按钮加速
- 在Google Plus上分享链接,分享按钮就在旁边
- Facebook喜欢和分享按钮javascript更新我的网页内容,如重新加载页面