其他分享
首页 > 其他分享> > js实现一键分享功能

js实现一键分享功能

作者:互联网

效果图如下在这里插入图片描述

代码如下

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>分享功能</title>
</head>
<body>
	<div class="bdsharebuttonbox" data-tag="share_1">
	     <a href="#" class="bds_more" data-cmd="more"></a>
	     <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
	     <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
	     <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
	     <a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
	     <a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
	</div>
<script>
     window._bd_share_config = {
	    "common": {
		"bdSnsKey": {},
		//分享的标题
		"bdText": "分享的标题",
		//分享的摘要
		"bdDesc": "分享的摘要内容",
		//分享的Url地址
		"bdUrl": "",
		//下拉浮层中分享按钮的列数
		"bdMini": "2",
		//自定义下拉浮层中的分享按钮类型和排列顺序  
		"bdMiniList": false,
		"bdPic":'',//分享的图片
		//显示风格和大小
		"bdStyle": "0",
		"bdSize": "32"
	     },
	     "share": {},
	     "image": {        
	     "viewList": ["weixin", "tsina", "qzone", "tqq"],
		 "viewText": "分享到:",
		 "viewSize": "16"
	      },
	     "selectShare": {
		  "bdContainerClass": null,
		  "bdSelectMiniList": ["weixin", "tsina", "qzone", "tqq"]
		}
};
	with(document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];
</script>
</body>
</html>

标签:下拉浮层,一键,share,js,tqq,qzone,分享
来源: https://blog.csdn.net/cst522445906/article/details/118381279