MVC:用bShare插件分享内容至QQ空间

参考网址:https://blog.csdn.net/u013126379/article/details/52862080

html:

<div>
    <img id="img1" src="~/Image/p1.jpg" alt="p1"/>
</div>
<br />
<div>
    <span>非常努力!</span>
</div>
<br />
<div>
    <div class="bshare-custom" title="标题" url="别人查看分享跳转网址,例如:https://www.baidu.com" summary="内容" pic="" ></div> 
</div>

JavaScript:

    <script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/button.js#style=-1&uuid=&pophcol=2&lang=zh"></script>
    <script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>

    <script>
        //bShare分享至QQ空间等
        $(document).ready(function () {
            var $shareBox = $(".bshare-custom");
            //加载分享工具  
            var tools = '<a title="分享到QQ空间" class="bshare-qzone"></a>';
            tools += '<a title="分享到新浪微博" class="bshare-sinaminiblog"></a>';
            tools += '<a title="分享到人人网" class="bshare-renren"></a>';
            tools += '<a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>';
            $shareBox.append(tools);
            //绑定分享事件  
            $shareBox.children("a").click(function () {
                var parents = $(this).parent();
                bShare.addEntry({
                    title: parents.attr("title"),
                    url: parents.attr("url"),
                    summary: parents.attr("summary"),
                    pic: parents.attr("pic")
                });
            });
        });
        
    </script>

 

猜你喜欢

转载自blog.csdn.net/zcc9618/article/details/89312866
0条评论
添加一条新回复