Giter Site home page Giter Site logo

js-share's Introduction

JS原生分享插件

###描述 合并了文本生成base64图片的插件,调用简单,配置清晰,一行代码即可搞定zgShare.listen();,同时你也可以不把它当做 一个分享的插件来用 你只需

    zgShare.config({url:'http://www.baidu.com'}).listen(null,function (data) {
        console.log(data);
    });

data参数里面也包含了你需要的 根据url生成的base64的图片 ###建立 你可以通过这种方式引入

<script type="text/javascript" src="zgShare.js"></script>

然后在你引入的js底部使用 前提是你创建了这个元素

zgShare.listen();
zgShare.config.({}).listen();
zgShare.config.({url:'zxxxxxxx'}).listen(null,function(data){  );

###配置参数

参数名 描述
empty_hint 如果参数为空默认补填的内容 默认是“无内容”
url 分享的地址 【默认是当前url】
source 分享的作者 【默认是meat author】
title 分享的标题 【默认是meat title】
description 分享的描述 【默认是meat description】
image 分享的图片【默认是网页第一张图片地址】
sites ['wechat','qq','weibo'], // 分享的站点【默认全都有】
target '_blank' //打开方式

使用示例

index.html

    <style>
         /*这个样式你自己随意定义即可 他是 默认 分享插件的外部包含框*/
        #social-share{
            position: fixed;
            right: 0;
            margin-right: 80px;
            bottom: 200px;
        }
    </style>
    <!--包含框-->
    <div id="social-share"></div>
    <script type="text/javascript" src="zgShare.js"></script> 
    <script>
      zgShare.listen();
      //or
      zgShare.config.({
        title:'xxxx',
        url:'xxxxx',
        source:'xxx',
        description:'xxxxx'
        // ..........
        }).listen("#social-share",function(parameter){
       });
    </script>
有问题

有问题联系我 qq:464032204

js-share's People

Contributors

zg199519 avatar

Watchers

James Cloos 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.