Facebook共享按钮的自定义图像 [英] Custom image for Facebook share button

查看:153
本文介绍了Facebook共享按钮的自定义图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在互联网上搜索了一段时间,我找不到任何有效的。我想使用我自己的自定义图像的共享按钮,但每当我尝试环绕图像时,共享按钮消失。对不起,缺乏信息,因为我是新的Facebook SDK。

I've been searching around the internet for a while now and am unable to find anything that works. I want to use my own custom image for the share button but whenever I try to surround the image the share button disappears. Sorry for lack of information because I'm new to the Facebook SDK. Any help would be greatly appreciated, thanks.

我拥有的当前代码:

<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button"><img src="Images/Icons/facebook.png" class="link"></div>


推荐答案

此代码适用于我:

<!-- facebook -->
<img src="[YOUR_FACEBOOK_PIC]" alt="Share on Facebook" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent('[YOUR_PAGE_URL]'),'facebook-share-dialog','width=626,height=436'); return false;">

<!-- twitter -->
<img src="[YOUR_TWITTER_PIC]" alt="Share on Twitter" onclick="javascript:window.open('https://twitter.com/share?text=[SOME_TEXT_TO_PREPOLUTATE_TWEET]&amp;url=[YOUR_PAGE_URL]','Twitter-dialog','width=626,height=436'); return false;">

<!-- google+ -->
<img src="[YOUR_GOOGLE_PIC]" alt="Share on Google Plus" onclick="window.open('https://plus.google.com/share?url=[YOUR_PAGE_URL]','Google-dialog','width=626,height=436'); return false;">

只需在括号之间替换文本,不要忘记url encode

Just replace the text between brackets, and don't forget to "url encode" all the text that goes in the url to avoid issues.

它不需要任何SDK的SDK。

And it doesn't need the SDK for any of them.

这篇关于Facebook共享按钮的自定义图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆