简体   繁体   English

Facebook喜欢带有大按钮的插件?

[英]Facebook Like plugin with big buttons?

I need a social media plugin just for FB. 我需要一个仅用于FB的社交媒体插件。 I need big share buttons for FB. 我需要FB的共享按钮。 I have seen it in several websites but I do not know which one it is. 我已经在几个网站上看到过,但我不知道它是哪个。

I leave this link to show you what I am talking about (big FB buttons at the beginning and ending of the article): 我留下此链接来向您展示我在说什么(文章开头和结尾的大FB按钮):

http://www.viralnova.com/animals-eating-ice-cream/ http://www.viralnova.com/animals-eating-ice-cream/

Any idea? 任何想法?

There's no secret sauce for making big like (that's not a like button, that's share button) button it all comes down to basic knowledge in Facebook developers tools ... 创建大的“赞”(不是“赞”按钮,这是“共享”按钮)并没有秘诀,这全都归功于Facebook开发人员工具中的基础知识...

Facebook has the Sharer which accept the GET parameter u which is the URL you want to share on your timeline, on a friend's wall or even in a private message ... Facebook的Sharer接受GET参数u ,它是您要在时间轴,朋友的墙上甚至是私人消息中共享的URL。

Break Down 分解

You can create a new element or wrapper for your share button I will just use <a> because they seems quick and easy to use for this purpose. 您可以为您的共享按钮创建一个新元素或包装器,我将只使用<a>因为它们似乎可以快速方便地用于此目的。

<a class="fsl fsl-facebook" data-href="{URL_to_Share}" href="#">
   <span class="fa-facebook fa-icons fa-lg"></span>
   <span class="sc-label">Share on Facebook</span>
</a>

pay attention to data-href attribute as you should replace it with the URL you want to share 注意data-href属性,因为您应该将其替换为要共享的URL

next we need some JavaScript (jQuery) to make our share button do something 接下来,我们需要一些JavaScript(jQuery)来使共享按钮执行某些操作

$('.fsl-facebook').click(function(e){ // target all elements with fsl-facebook class in the DOM
    e.preventDefault(); // prevent scrolling to top or bottom, because href is set to # 
    var href = $(this).attr('data-href'); // get URL from the data-href 
    window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(href), "", "width=800, height=350"); // pop up a new window, it's prefered to urlencode the URL because of 2nd & 3rd GET parameter that can be found in some URLs (?a=1&b=2&c=3)
});

DEMO 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM