Giter Site home page Giter Site logo

crazyrhino / social-share Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harttle/social-share

0.0 2.0 0.0 64 KB

Social share widget supporting: wechat, weibo, linkedin, github, google+, rss, twitter, facebook and more.

JavaScript 64.54% CSS 35.46%

social-share's Introduction

social-share

Social share widget supporting: wechat, weibo, linkedin, github, google+, rss, twitter, facebook and more.

Demo: http://harttle.com/social-share/

Dependencies Fontawesome, jQuery.

Usage

Import jQuery and Fontawesome:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

Import Social Share:

<link rel="stylesheet" href="path/to/social-share.min.css">
<script src="path/to/social-share.min.js"></script>

Add script like this:

var links = {
    facebook: {
        index: 2,
        url: 'https://www.facebook.com/harttle'
    },
    'google-plus': {
        index: 1,
        url: 'https://plus.google.com/+杨珺'
    },
    weibo: {
        index: 3,
        url: 'http://v.t.sina.com.cn/share/share.php?url=xxx&title=xxx&appid=xxx'
    },
    wechat: {
        index: 4,
        url: location.href
    },
    linkedin: {
        index: 5,
        url: 'https://linkedin.com/in/harttle'
    },
    rss: {
        url: 'http://harttle.com/feed.xml'
    },
    github: {
        url: 'https://github.com/harttle'
    },
    twitter: {
        url: 'https://twitter.com/harttleharttle'
    },
};

$('div').socialShare({ links: links, size: 'lg'});

Options

links

Type: Object

Default: {}

Share buttons are set in links object.

size

Type: String

Default: "md"

Size of the buttons, available values:

  • "lg"(large)
  • "md"(medium)
  • "sm"(small)
  • "xs"(exteme small)

blank

Type: Boolean

Default: true

Should the links open in new window? If set true, target="_blank" will be set.

links.url

Type: String

The href attribute for the the share button. For "wechat", links.url is the url encoded within the qrcode img.

links.index

Type: Number

Optional, share buttons are sorted by links.index.

social-share's People

Contributors

harttle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.