微博、微信、qq、空间、等分享功能
这个jquery.qrcode.min.js是生成二维码的js
< script type = "text/javascript" src = "jquery/jquery.qrcode.min.js" > < / script >
< script type = "text/javascript" >
$ ( function ( ) {
var share_title = "分享微博、qq、QQ空间等标题" ;
/ / 生成分享二维码
var pathurl = window . location . href ;
$ ( '.share_wechat_img' ) . qrcode ( {
render: 'table' ,
text: pathurl ,
width: '110' ,
height: '110' ,
correctLevel: 0 //扫二维码的未定性,多个的话可以用( 1 , 2 , 3 等)。
} ) ;
/ * 分享到微信 * /
$ ( ".btn_share_wechat" ) . hover ( function ( ) {
$ ( ".share_wechat_box" ) . show ( ) ;
} , function ( ) {
$ ( ".share_wechat_box" ) . hide ( ) ;
} ) ;
/ * 分享到QQ * /
$ ( ".btn_share_qq" ) . on ( "click" , function ( ) {
var _shareUrl = 'http://connect.qq.com/widget/shareqq/index.html?' ;
_shareUrl + = 'url=' + encodeURIComponent ( pathurl ) ;
_shareUrl + = '&title=' + encodeURIComponent ( share_title ) ;
window . open ( _shareUrl ) ;
} ) ;
/ * 分享到QQ空间 * /
var share_zone_url = pathurl ;
$ ( ".btn_share_zone" ) . on ( "click" , function ( ) {
var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?' ;
_shareUrl + = 'url=' + encodeURIComponent ( pathurl ) ;
_shareUrl + = '&title=' + encodeURIComponent ( share_title ) ;
window . open ( _shareUrl ) ;
} ) ;
/ * 分享到新浪 * /
$ ( ".btn_share_xinlang" ) . on ( "click" , function ( ) {
var _shareUrl = 'http://v.t.sina.com.cn/share/share.php?' ; / / appkey别人的
_shareUrl + = 'url=' + encodeURIComponent ( pathurl ) ;
_shareUrl + = '&title=' + encodeURIComponent ( share_title ) ;
window . open ( _shareUrl ) ;
} ) ;
/ * 分享到豆瓣 * /
$ ( ".btn_share_douban" ) . on ( "click" , function ( ) {
var _shareUrl = 'http://shuo.douban.com/!service/share?' ;
_shareUrl + = 'href=' + encodeURIComponent ( pathurl ) ;
_shareUrl + = '&name=' + encodeURIComponent ( share_title ) ;
window . open ( _shareUrl ) ;
} ) ;
/ * 分享到腾讯微博 * /
$ ( ".btn_share_tengxun" ) . on ( "click" , function ( ) {
var _shareUrl = 'http://v.t.qq.com/share/share.php?' ;
_shareUrl + = 'title=' + encodeURIComponent ( share_title ) ;
_shareUrl + = '&url=' + encodeURIComponent ( pathurl ) ;
window . open ( _shareUrl ) ;
} ) ;
/ * 分享到人人网 * /
$ ( ".btn_share_renren" ) . on ( "click" , function ( ) {
var _shareUrl = 'http://share.renren.com/share/buttonshare.do?' ;
_shareUrl + = 'link=' + encodeURIComponent ( pathurl ) ;
_shareUrl + = '&title=' + encodeURIComponent ( share_title ) ;
window . open ( _shareUrl ) ;
} ) ;
} ) ;
< / script >