https://github.com/assisfery/socialsharejs
Library to make your web page shareable fast and easy in all the majors social networks.
https://github.com/assisfery/socialsharejs
javascript javascript-library social-network social-share
Last synced: over 1 year ago
JSON representation
Library to make your web page shareable fast and easy in all the majors social networks.
- Host: GitHub
- URL: https://github.com/assisfery/socialsharejs
- Owner: assisfery
- License: mit
- Created: 2019-11-12T19:08:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-23T22:05:35.000Z (about 4 years ago)
- Last Synced: 2023-05-13T12:23:22.151Z (about 3 years ago)
- Topics: javascript, javascript-library, social-network, social-share
- Language: JavaScript
- Homepage:
- Size: 112 KB
- Stars: 22
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SocialShareJS
This is a simple libray to make your web page shareable fast and easy.
Its allow to include the social share link of the major social network to your page.
See the demo here: https://assisfery.github.io/SocialShareJS/index.html
CDN repository: https://www.jsdelivr.com/package/gh/assisfery/SocialShareJS
[](https://www.jsdelivr.com/package/gh/assisfery/SocialShareJS)
### Install
Just include the **social-share.css** and **social-share.js** files.
```html
```
### Dependences
The **SocialShareJS** don't dependents of none library, but its uses the **FontAwesome 5** Fonts, so make sure you have included it in your web page.
```html
```
### Get Started
To have the social share buttons just put the class **ss-box** in one or more of you **containers**
```html
```
### Selected Social
If you want to select specifics social share network just add the **data-ss-social** attribute in your container.
```html
```
### Change Link
For defaults the SocialShareJs put the atual page location as share link but you can change it just including the **data-ss-link** attribute in your container.
```html
```
### Custom Query String
In some of social network shares you could want to put a query string available just to specific social network, so to do that just include
**data-ss-_NAME_OF_SOCIAL_MEDIA = "key1:value1, key2:value2"** attribute,
for example
include **data-ss-messenger = "app_id:123456"**, so it will include the query string **&app_id=123456** in messenger share link, or
include **data-ss-email = "subject:SocialShareJS is amazing"**, it will include the query string **&subject=Email Subject** in
email share link.
```html
```
### Responsive check
Some of buttons (like: **share native** ,**messenger**, **viber** and **sms**) perhaps not work on desktop OS, but its works in mobile OS like Android and IOS, so may be necessary to show that buttons only in mobile screen.
To solve that problem you could include the class **ss-responsive** on your container.
```html
```
### Customizations
##### Hide Social Network Name
If you want to show just the icons without the name of Social Network just include **data-ss-content** attribute with value **false**.
```html
```
##### Rounded buttons
If you want to make button with circle shape just include the class **ss-circle** in **ss-box** container.
```html
```
##### Flat buttons
If you want to make button without rounded border just include the class **ss-flat** in **ss-box** container.
```html
```
##### Pill buttons
If you want to make button with pill shape effect just include the class **ss-pill** in **ss-box** container.
```html
```
##### Button with Shadows
If you want to put shadow in button just include the class **ss-shadow** in **ss-box** container.
```html
```
##### Hide Icons
If you dont want to show the icons of Social Network just include **data-ss-icon** attribute with value **false**.
```html
```
##### Change Icons
If you want to change the icon class of any Social Network to another icon of you preference or icon of others packages just include the **data-ss-icon-class** with value **social_name1: icon_class1, social_name2: iconclass2**
for example:
include **data-ss-icon-class="facebook:fab fa-facebook-messenger,email:fas fa-sms"** so it will put the icon **fab fa-facebook-messenger** instead the facebook default icon and it will put the icon **fas fa-sms** instead the email default icon.
```html
```
### Hover Effects
##### Grow
Include **ss-grow** in your container to make button grow when the mouse is hover.
```html
```
##### Shrink
Include **ss-shrink** in your container to make button shrink when the mouse is hover.
```html
```
##### Rotate
Include **ss-rotate** in your container to make button rotate when the mouse is hover.
```html
```
##### Float
Include **ss-float** in your container to make button float when the mouse is hover.
```html
```
### JavaScript Utils
If you want to create a share box in JavaScript you can use the follow function.
```
SocialShare.createShareBox(_elements, _link = null, _socials = null, _showIcon = true, _showContent = true, _clearContainer = true);
```
- **_elements** - the dom elements where the socials buttons will be created
- **_link** - the link/content will be shared, by default will be the current window location
- **_showIcon** - the social button icon will be presented or not
- **_showContent** - the social button name/label will be presented or not
- **_clearContainer** - clear or not the elements before create the buttons
For example
```
SocialShare.createShareBox("#newShareBox", "https://github.com/assisfery/SocialShareJS", "facebook, twitter, email, sms, viber");
```
##### Just Move On...
If you want to customize the share buttons like you want just do it adding css effect in your code.
```css
.ss-btn {
/* your code */
}
```