This jQuery plugin allow you to easily add a sharebox (list of social buttons) on your website.
Simply load jQuery and the provided files from the right place:
<!-- jQuery -->
<script src="path/to/jquery.min.js"></script>
<!-- jquery.sharebox -->
<script src="path/to/jquery.sharebox.min.js"></script>
<link href="path/to/jquery.sharebox.min.css" rel="stylesheet">
Note: The optional jquery.sharebox.icons.css
stylesheet contains all
icons in the data URI scheme.
jquery.sharebox will automatically load any .sharebox
elements:
<!-- .sharebox elements are automatically loaded -->
<div class="sharebox"></div>
Off course, you can also initialize jquery.sharebox with the element you want:
<div id="my-sharebox"></div>
<script>
jQuery(document).ready(function() {
jQuery("#my-sharebox").sharebox();
});
</script>
jquery.sharebox accepts the following options:
Name | Description | Default value |
---|---|---|
url | The URL to share | URL of the document |
title | The name of the element to share | Title of the document |
services | The services you want to use * | facebook twitter google+ |
* Separated by space
With jquery.sharebox, you can easily set options using HTML5 custom data attributes.
<!-- .sharebox elements are automatically loaded -->
<div class="sharebox"
data-url="http://www.example.com/"
data-title="My awesome title"
data-services="facebook twitter google+ print"
></div>
The jquery.sharebox plugin allows you to set options by passing an object on initialization:
<div id="my-sharebox"></div>
<script>
jQuery(document).ready(function() {
jQuery("#my-sharebox").sharebox({
url : "http://www.example.com/",
title : "My awesome title",
services : "facebook twitter google+ print"
});
});
</script>
By default, jquery.sharebox includes the following services :
- digg - Share on Digg
- facebook - Share on Facebook
- google+ - Share on Google+
- linkedin - Share on LinkedIn
- pinterest - Share on Pinterest
- pocket - Share on Pocket
- reddit - Share on Reddit
- stumbleupon - Share on StumbleUpon
- tumblr - Share on Tumblr
- twitter - Share on Twitter
- print - Open the Print Dialog
Simply do what the fuck you want.