【问题标题】:How to make Custom Facebook, Twitter and Other Social Networking buttons如何制作自定义 Facebook、Twitter 和其他社交网络按钮
【发布时间】:2013-01-05 01:32:51
【问题描述】:

我看到了这个网站,我注意到它有一个自定义的 Facebook 和 Twitter 按钮。

http://www.mint.com/blog/how-to/4-essential-questions-to-ask-at-the-end-of-a-job-interview/

我想知道如何在我的网站中实施?

【问题讨论】:

    标签: button facebook-like social-networking twitter-button


    【解决方案1】:

    现在,有很多 jquery 插件可以帮助您自定义您的社交网络按钮。 例如

    1. Sharrre 插件(网址:http://sharrre.com
    2. Koottam 社交 jQuery 插件 (http://jobyj.in/koottam-jquery-plugin/index.html)

    【讨论】:

      【解决方案2】:

      如果你想自己做,这里有一个参考:Custom Twitter button and Custom Facebook button 脸书:

      <div id="fb-root"></div>
      <script>
      
          window.fbAsyncInit = function() {
              FB.init({
                  appId: '{appId}',
                  status: true,
                  xfbml: true
              });
          };
      
          (function(d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) {
                  return;
              }
              js = d.createElement(s);
              js.id = id;
              js.src = "//connect.facebook.net/en_US/all.js";
              fjs.parentNode.insertBefore(js, fjs);
          }(document, 'script', 'facebook-jssdk'));
      
          $(document).on(
                  'fbpost', //  <—- HERE'S OUR CUSTOM EVENT BEING LISTENED FOR
                  function() {
      
                      FB.ui(
                              {
                                  method: 'feed',
                                  name: '{appShareName}',
                                  message: '{appShareMessage}',
                                  caption: '{appShareCaption}',
                                  description: (
                                          '{appShareDescription}'
                                          ),
                                  link: '{appLink}',
                                  picture: '{appURLToImage}',
                                  actions: {
                                      name: '{appShareActionName}',
                                      link: '{appActionLink}'
                                  }
                              },
                      function(response) {
                          if (response && response.post_id) {
                              alert('Post was published.');
                          }
                      });
                  });
          $(document).ready(function() {
              $('.facebook').click(function() {
                  $(document).trigger('fbpost');
              });
          });
      
      </script>
      
      <div class="facebook"><img src="/assets/images/facebook.png" /></div>
      

      推特:

      <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
      
      <div class="twitter">
          <a href="https://twitter.com/intent/tweet?url={appLink};text={appShareMessage};size=l&amp;count=none">
              <img src="/assets/images/twitter.png" />
          </a>
      </div>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-12
        • 2012-02-16
        • 2015-05-18
        • 2017-09-15
        相关资源
        最近更新 更多