share.js分享 JQ第三方分享插件 可自定义链接、标题

37 篇文章 0 订阅

1、直接使用以下代码
2、加载附件中的js、css
3、定义要分享的链接

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>分享</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no, email=no" />
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="layer_mobile/layer.js"></script>

    <!-- share css & js -->
    <link rel="stylesheet" href="share/css/share.min.css">
    <script src="share/js/social-share.min.js"></script>
    <style type="text/css">
        .social-share .social-share-icon{width: 50px !important;height: 50px !important;line-height: 50px !important;margin-left: 0.5rem;}
        .share_title{color:#c01414;text-align: center;font-size: 0.38rem;line-height: 1rem;}
    </style>

</head>
<body>

    <button onclick="do_share();">分享</button>

    <div id="share_box" style="display:none;">
        <h1 class="share_title">分享到</h1>
        <div class="social-share" data-initialized="true" style="text-align: center;" data-url="http://www.baidu.com?(要分享的链接)"  data-title="要分享的标题(可选)">
            <a href="#" class="social-share-icon icon-weibo"></a>
            <a href="#" class="social-share-icon icon-wechat"></a>
            <a href="#" class="social-share-icon icon-qq"></a>
            <a href="#" class="social-share-icon icon-qzone"></a>
        </div>
    </div>

    <script type="text/javascript">
        //弹出页面层
        function do_share(){
            layer.open({
            type: 1
            ,content: $('#share_box').html()
            ,anim: 'up'
            ,style: 'position:fixed; bottom:0; left:0; width: 100%; padding:10px 0; border:none;'
            });
        }
    </script>
</body>
</html>

css、js静态资源文件,百度云盘下载地址:https://pan.baidu.com/s/1ec0GJ8

自定义配置:

data-url : ”, // 网址,默认使用 window.location.href
data-source : ”, // 来源(QQ空间会用到), 默认读取head标签:
data-title : ”, // 标题,默认读取 document.title 或者
data-origin : ”, // 分享 @ 相关 twitter 账号
data-description : ”, // 描述, 默认读取head标签:
data-image : ”, // 图片, 默认取网页中第一个img标签

详细教程链接:https://github.com/overtrue/share.js

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

每天都进步一点点

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值