2015-07-13 69 views
0

提供的默認Facebook分享按鈕我有一個facebook的自定義圖像,當用戶點擊時,它會分享的東西,然而,developers.facebook提供的元素,將自動生成共享按鈕與下面的代碼自定義在developers.facebook.com

<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button"></div> 

我想使用我的自定義圖像使用生成的代碼彈出共享頁,有沒有辦法?

%a.link.facebook{href: "some_url_here"} 

我已經搜索了網,我依然堅持,

感謝您的幫助,即時通訊仍然是一個初學者,:)

+0

[對於Facebook分享按鈕自定義圖像]的可能重複( http://stackoverflow.com/questions/28510338/custom-image-for-facebook-share-button) – Pavan

+0

製作你自己的按鈕,然後從JS SDK中使用'FB.ui',或者打開你自己的popu p與共享對話框的URL版本。 https://developers.facebook.com/docs/sharing/reference/share-dialog – CBroe

+0

非常感謝主席:) –

回答

0

許多建議是有用的,感謝所有的人,但我覺得這個方法更簡單,我想分享給你們。

使用Javascript(把它放在頁眉或頁腳) -

<script> 
function fbShare(url, title, descr, image, winWidth, winHeight) { 
    var winTop = (screen.height/2) - (winHeight/2); 
    var winLeft = (screen.width/2) - (winWidth/2); 
    window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight); 
} 
</script> 

你的鏈接或圖片

<a href="javascript:fbShare('http://jsfiddle.net/stichoza/EYxTJ/', 'Fb Share', 'Facebook share popup', 'http://goo.gl/dS52U', 520, 350)">Share</a> 

http://jsfiddle.net/stichoza/eyxtj/

相關問題