有誰知道如何創建Facebook分享按鈕?我需要它是大約15-20像素高的水平版本。他們似乎已經放棄了任何贊成類似按鈕的文檔,但我希望兩者都可以。我似乎只能找到wordpress插件,但我只需要代碼片段。Facebook分享按鈕代碼片段
任何幫助,將不勝感激...三江源
格林 勞卡服裝
有誰知道如何創建Facebook分享按鈕?我需要它是大約15-20像素高的水平版本。他們似乎已經放棄了任何贊成類似按鈕的文檔,但我希望兩者都可以。我似乎只能找到wordpress插件,但我只需要代碼片段。Facebook分享按鈕代碼片段
任何幫助,將不勝感激...三江源
格林 勞卡服裝
,如果你想使用JavaScript SDK做到這一點:
window.fbAsyncInit = function() {
FB.init({ appId: appId, status: true, cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
$("#Pst").click(function shareWithFacebook() {
FB.ui({ method: 'stream.publish',
message: 'message',
user_message_prompt: 'message',
attachment: {
name: 'message',
caption: 'message',
description: ('message'),
href: 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg',
media: [{ 'type': 'image', 'src': 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg', 'href': 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg'}]
},
action_links: [{ text: ' Name ', href: 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg'}]
},
function (response) {
if (response && response.post_id) {
// Do some custom action after the user successfully
// posts this to their wall
alert('Thanks for sharing!');
}
}
);
return false;
});
<div id="fb-root">
</div>
<a href="#" id="Pst" onclick="return shareWithFacebook();" >
Share
</a>
,如果你想使用插件來做到這一點並請你把它標記爲回答:): http://developers.facebook.com/docs/reference/plugins/like/
你會發現代碼l IKE說:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=137344766349901&xfbml=1"></script><fb:like href="www.eslamsoliman.uk.cm" send="true" width="450" show_faces="true" font=""></fb:like>
改變你的鏈接:)
的分享按鈕已被棄用,儘管仍然正常工作。 目前推薦的實現從網站共享的方式是通過Like button或Send button(它通常也與Like按鈕配對,但獨立工作)。
如果必須使用舊共享按鈕,出於某種原因,該文件是在開發者網站不再可用,但這裏有一個第三方例如:http://www.wpcode.net/add-share-button.html/
(它應該在任何網站,而不僅僅是WordPress的博客工作)