Custom facebook share button » History » Version 1
Benone Gaiță, 2021-05-14 21:06
1 | 1 | Benone Gaiță | h1. Custom facebook share button |
---|---|---|---|
2 | |||
3 | <pre><code class="javascript"> |
||
4 | <script> |
||
5 | window.fbAsyncInit = function() { |
||
6 | FB.init({ |
||
7 | appId : 'your-app-id', |
||
8 | xfbml : true, |
||
9 | version : 'v2.5' |
||
10 | }); |
||
11 | }; |
||
12 | |||
13 | (function(d, s, id){ |
||
14 | var js, fjs = d.getElementsByTagName(s)[0]; |
||
15 | if (d.getElementById(id)) {return;} |
||
16 | js = d.createElement(s); js.id = id; |
||
17 | js.src = "//connect.facebook.net/en_US/sdk.js"; |
||
18 | fjs.parentNode.insertBefore(js, fjs); |
||
19 | }(document, 'script', 'facebook-jssdk')); |
||
20 | </script> |
||
21 | |||
22 | <button class="ui facebook button">Share</button> |
||
23 | |||
24 | <script> |
||
25 | $(".ui.facebook.button").click(function() { |
||
26 | FB.ui({ |
||
27 | method: 'share', |
||
28 | href: 'your-webpage.html', |
||
29 | }, function(response){}); |
||
30 | }) |
||
31 | </script> |
||
32 | </code></pre> |