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

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

问题描述

我一直在互联网上搜索一段时间,无法找到任何有用的东西。我想使用自己的自定义图像分享按钮,但是当我尝试围绕图像时,共享按钮消失。抱歉因为缺少信息,因为我是Facebook的新手。非常感谢任何帮助,谢谢。

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编码所有文本进入url以避免问题。

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.

以下是每个参考官方文档:

Here are references to the official documentation for each of them:

  • Facebook (you can see it under the URL redirection section)
  • Twitter (you could also use https://twitter.com/intent/tweet as described here)
  • Google+ (under Share Link section)

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

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