【发布时间】:2016-01-29 11:23:39
【问题描述】:
我的社交媒体共享代码有问题。
请参阅下面的代码:
// 我想通过点击 facebook 分享按钮在 facebook 上分享这个 div (id="maindiv")...
<html>
<head>
</head>
<body>
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=17968886776";
fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));
</script>
<div id="maindiv1" style="border:1px solid blue;width:500px;height:230px">
<div style="border:0px solid red;width:100px;height:80px;float:left;">
<img src="http://localhost:8080/pushnotification/img/small-icon.png" /><img>
</div>
<h1 style="color:blue;font-family:sans-serif;float:left;width:390px;margin-top:10;text-align:center;border:0px solid red;">enterployee.com</h1>
<div style="border:0px solid red;width:100%;height:120px;float:left;">
<p style="font-family:sans-serif;font-size:15px;">
Enterployee.com is a employee relationship management tool for enterprise. It’s a fully managed notification platform for employees.
We have a vision to make organizations more professional and organized. After getting an enterployee account organizations can notify their employees easily and employees can connect with their company in better way.
</p>
</div>
<div style="border:0px solid red;width:80px;height:30px;float:right;">
<div class="fb-share-button" data-href="http://localhost:8080/pushnotification/img/small-icon.png" data-layout="button"></div>
</div>
</div>
</body>
所以问题是我的网站上有多个职位发布,我需要将此共享按钮添加到每个单独的 div,而不是整个页面。我已经完成了整页共享的编码,但在仅共享部分页面或 div 时需要帮助。
【问题讨论】:
-
“我的网站上有多个职位发布” – 理想情况下,您应该为每个职位提供一个单独的 URL,其中仅包含该职位的数据。然后,您可以将该单独的 URL 分享到 Facebook。
-
好的,如果我使用 url,则显示每个职位发布..
标签: facebook share fbml fbsdksharekit