Skip to content
stackcirclePublic
forked from kni-labs/rrssb

About

Ridiculously Responsive Social Sharing Buttons

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

494 Commits

Folders and files

Repository files navigation

Ridiculously Responsive Social Sharing Buttons

Love them or hate them, social sharing buttons appear to be with us for a while. It seemed like we were constantly making custom buttons for every single project, so we decided to create a super flexible system that would work in any container.

RRSSB is built with SASS, so you can easily customize it by tweaking a few variables. SVGs allow for tiny file size and retina support. Add or remove icons as you see fit — the rest will fill in automagically in the container.

Demo

View the demo here

Usage

  1. Link to the css file in header:
<link rel="stylesheet" href="css/rrssb.css" />
  1. Create an empty div to place the buttons in:
<div class="rrssb-container"></div>

You can add a fallback inside the div so that non-JS users will see something rather than nothing.

e.g.

<div class="rrssb-container">
  <!-- Fallback goes in here -->
  <p>This text will show for non-JS users.</p>
</div>
  • Buttons will automatically flow to the size of the div (in this case .rrssb-container). If fixed sized buttons are needed, make the .rrssb-container a fixed-width container.

e.g.

.rrssb-container {
  width: 500px;
}
  1. Link to javascript files at the bottom of your document before the closing body tag for best results. (jQuery CDN, jQuery fallback, and rrssb.min.js):
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery.1.10.2.min.js"><\/script>')</script>
<script src="js/rrssb.min.js"></script>
  1. Call the jQuery function on the div that you created (options are discussed below):
$(".rrssb-container").rrssb(options);
  1. Move the .min.svg files to /images/rrssb/ or a folder of your choosing (be sure to set it in the options).

Options

Should you desire to modify the default settings, here are is a list of available options (the values for each option are the defaults):

var options = {
  socialNetworks:       ["email", "facebook", "tumblr", "linkedin", "twitter", "reddit", "hackernews", "googleplus", "youtube", "pinterest", "pocket", "github", "vk"], // This is a list of all available social networks. The order you specify them is the order they appear
  showCount:            true, // Should the plugin show the share count?
  iconsLocation:        "/images/rrssb/", // The directory where the SVG icons are placed
  url:                  "", // By default uses the page URL
  pageName:             "", // By default uses the page name
  pageDescription:      "", // By default uses the page meta description
  emailSubject:         "", // By default uses the page name
  emailBody:            "", // By default uses "Check out this page: " plus the page meta description and URL
  twitterStatus:        "", // By default this uses the first 115 characters of the page name plus the URL. Don't worry about URL length, they are all shortened by Twitter. Use this to set a custom Twitter status (This overrides other Twitter options).
  googlePlusStatus:     "", // By default uses the page name and URL
  githubLink:           "", // By default uses "https://github.com/"
  tumblrName:           "", // By default uses the page name
  linkedinTitle:        "", // By default uses the page name
  linkedinSummary:      "", // By default uses the page description
  redditTitle:          "", // By default uses the page name
  redditText:           "", // By default uses the page description
  hackernewsTitle:      "", // By default uses the page name
  hackernewsText:       "", // By default uses the page description
  youtubeUrl:           "", // By default uses the page name
  pinterestMedia:       "", // By default is not set
  pinterestDescription: "", // By default uses the page description
}

NOTE: Don't just copy all the options with empty strings as the empty string will be used as the option value.

Example Setup

This is an example setup for a Twitter, Facebook and Google+.

var options = {
  socialNetworks: ["twitter", "facebook", "googleplus"]
}

$(".rrssb-container").rrssb(options);

Other install options:

Service Link
Bower bower install rrssb
Rails * Rails Setup by @rimkashox
Wordpress * Wordpress plugin by @aarreedd
Drupal * Drupal Install Instructions
CDN * OSSCDN by MaxCDN

* Managed by 3rd parties. Please contact project hosts for support.

Support

Currently tested between 140px and 15,465px on current versions of Chrome 33, Safari 7.0.2, Firefox 27, Opera 20, and IE9+.

Requires SVG

Version Notes

Version Note Issue(s) Backwards compatible?
1.8.0 Shiny new gulp/browser-sync dev environment /via @connorwyatt, updated Facebook icon, fixed TypeError: $ in js /via @QWp6t . (#93), (#97) ✓
1.7.6 Fixed an issue where icon hit areas were breaking out of containers (#94) ✓
1.7.5 Flexible Large Format icons text-size based on sibling count. Switched to MIT license. (#18) ✓
1.7.2 Better calc detection & fallback /via @IanCaunce (#89) ✓
1.7 Javascript Meta attributes as variables /via @aicarlson (#47) ✓
1.6.5 Namespace CSS classes - Legacy HTML will be incompatible until class names updated. (#42) ✕

Contributing

Thanks for helping! Please use dev branch for all pull requests.

Setup:

  • Make sure gulp is installed globally: npm install -g gulp (May require sudo.)
  • run npm install to install the dependencies for this project.
  • run gulp to create a local server at localhost:3000 and watch for file changes.

About

RRSSB is a KNI Labs freebie crafted by @dbox and @joshuatuscan.

About

Ridiculously Responsive Social Sharing Buttons

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages