# Social Likes Beautiful “like” buttons with counters for popular social networks: Facebook, Twitter, LiveJournal, etc. Uses jQuery. ## Features - Easy to install. - Beautiful and all in one style. - Won’t explode your page’s layout. ## Installation and configuration Use [interactive builder](http://sapegin.github.io/social-likes/) to generate the code. Or install via [Bower](http://bower.io/): `$ bower install social-likes`. ## Advanced configuration ### Layout #### Default All buttons in a row. ``` ``` #### Vertical All buttons in a column. ``` ``` #### Single button One button with a counter (summ of all the networks). Opens popup with like buttons in vertical layout. Use `data-single-title` attribute to change button title. ``` ``` #### Icons only If you want to remove button titles add `social-likes_notext` class to make it looks better. ``` ``` ### Options Options define via HTML data attributes. `url` URL of shareable page. Current page by default. `title` Title for Twitter, Vkontakte and LiveJournal. Current page’s title by default. `html` HTML code for LiveJournal button. By default tag with link to current page. `counters` Disables “likes” counters when “no”. Default: “yes”. `single-title` Share button title for “single button” mode. Default: “Share”. Examples: ```html ``` ```html ``` ### Services specific options #### Twitter You can specify `via` (site’s Twitter) and `related` (any other Twitter you want to advertise) values for `
  • `: ```html
  • Twitter
  • ``` #### Pinterest You should specify an image URL via data-media attribute on `
  • `: ```html
  • Pinterest
  • ``` ### Manual initialization Could be useful on dynamic (Ajax) websites. ```html ``` ```javascript $('#share').socialLikes(); ``` ### Events #### `counter.social-likes` Triggers for every non-zero counter. ```javascript $('.social-likes').on('counter.social-likes', function(event, service, number) { // service: facebook, twitter, etc. }); ``` ### Experimental Google+ counter Place `googleplusonecount.php` somewhere on your server. And change buttons HTML like this: ```html
  • Google+
  • ``` ### Adding your own button You can find some custom buttons in `contrib` folder. Define `socialLikesButtons` hash: ```javascript var socialLikesButtons = { surfingbird: { popupUrl: 'http://surfingbird.ru/share?url={url}', pupupWidth: 650, popupHeight: 500 } }; ``` If you know the social network search page's url, you can make a link to results of searching in this network. There are search urls for Twitter and VKontakte by default. ```javascript var socialLikesButtons = { twitter: { ... searchUrl: 'https://twitter.com/search?src=typd&q={url}' } }; ``` Add some CSS: ```css .social-likes__button_surfingbird { background: #f2f3f5; color: #596e7e; border-color: #ced5e2; } .social-likes__icon_surfingbird { background: url(http://surfingbird.ru/img/share-icon.png) no-repeat 2px 3px; } ``` And use in like any other button: ```html
  • Surf
  • ``` See sources (`src` folder) for available options and class names and `contrib` folder for custom buttons examples. ### Title, description and image for Facebok and Twitter You can add they using [Facebook Open Graph](http://davidwalsh.name/facebook-meta-tags) and [Twitter Card](https://dev.twitter.com/docs/cards): ```html ``` `og:url`, `og:title`, `og:description`, `og:image` [should](http://vk.com/dev/widget_like) also work for Vkontakte. ### How to use Social Likes with Wordpress, etc. See [wiki](https://github.com/sapegin/social-likes/wiki/How-to-use-Social-Likes-with-Wordpress,-etc.). ## Release History ### 2013-08-26 v2.0.12 * Icons only mode (by [@albburtsev](https://github.com/albburtsev)). ### 2013-08-08 v2.0.11 * `counter.social-likes` event (#32). ### 2013-06-20 v2.0.10 * Prevent layout breaking without labels (#31). ### 2013-04-23 v2.0.8 * New Odnoklassniki API. * Improved manual initialization. * Compress CSS with CSSO. ### 2013-02-05 v2.0.7 * `data-title` and `data-url` attributes (by [@jalkoby](https://github.com/jalkoby]). * Pinterest button (mostly by [@jalkoby](https://github.com/jalkoby]). * Code button removed. --- ## License The MIT License, see the included `License.md` file.