$(function() { $('.weixinicon').attr( 'data-qrcode', 'http://www.xinhongru.com/qrcode/qrcode.php?content=' + window.location.href ) //测试 //$(".weixinicon").attr("data-qrcode","/qrCode/Index.aspx?url="+window.location.href); //正式用这个,已经更新到后台 //分享 //微博 $('.share_wb').click(function() { var url = $(this).data('txt') var url = window.location.href var title = document.title var op = 'http://service.weibo.com/share/share.php?title=' + title + '&url=' + encodeURIComponent(url) + '' window.open(op) }) //QQ $('.share_qq').click(function() { var url = $(this).data('txt') var url = window.location.href var title = document.title var op = 'http://connect.qq.com/widget/shareqq/index.html?url=' + encodeURIComponent(url) + '' window.open(op) }) //豆瓣 $('.share_db').click(function() { var url = $(this).data('txt') var url = window.location.href var title = document.title var op = 'https://www.douban.com/share/service?href=' + encodeURIComponent(url) + '&title=' + title + '' window.open(op) }) $(".share_bd").click(function () {//百度贴吧 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://s.share.baidu.com/mshare?url=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) $('.weixinicon').click(function() { //微信 var url = $(this).attr('data-qrcode') //alert(url) var title = '' title += "
" title += "x" title += '

二维码

' title += "
" title += '

扫一扫

' title += '
' $('body').remove('.weixin') $('body').append(title) }) $(document).on('click', '.weixin .c', function() { $('.weixin').remove() }) })