缺陷

如果从主页点击进入文章页面,点击二维码按钮无法正确弹出二维码,提示js报错,刷新之后就没这个问题了,目前还未解决。还望有高手指点。

已修正,查看文章《在文章底部添加QQ空间分享及修正微信二维码生成方式》

以下正文

这几天一直没有心情写故事,索性再捣鼓捣鼓博客,其实一直很喜欢素锦博客的格局,包括我自己还弄了一个同主题博客 星宇Star ,只是这种博客只适合原创型,不适合我这种大老粗,所以一直用的现在这个主题。
早就想在我的文章底部添加二维码分享和weibo分享,一直苦于看不懂代码,没法移植过来,这两天也是一直在研究这个问题,把博客弄挂了N次之后,总算是成功了,也许吧。
通过二维码分享,可以直接用微信或者QQ扫描二维码分享链接;通过点击weibo分享按钮可以直接分享到微博。
所以把这些分享出来,有需要的朋友可以取走。

php

<div class="share"><a title="获取二维码" class="icon-wechat" href="javascript:;"></a><!----><a href="javascript:void((function(s,d,e){try{}catch(e){}var f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&amp;title=',e(d.title),'&amp;appkey='].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));" rel="nofollow" class="icon-weibo" title="分享到新浪微博"></a><div id="qr"></div></div>

CSS

.share a {display: inline-block;color: #666;margin-right: 15px}.share a:hover {color: #f55}.share {position: relative;text-align: right;font-size: 25px;}.icon-wechat:before {content: "\e607";}.icon-weibo:before {content: "\e608";}#qr {z-index: 10;display: none;position: absolute;background: #fff;right: 10%;top: -290%;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px}@font-face { font-weight:400;font-style:normal;font-family:icomoon;src:url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SA2wAAAC8AAAAYGNtYXAaVsyWAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x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EwUqTkQ2Eg8GDB8WFTA3PSAFEQVBZUYmAgHUFxgynjEwBCsXSE1JGhYUsi9DSC4vQwFFMAAAAQAAAAEAACwIb51fDzz1AAsEAAAAAADRgYkQAAAAANGBiRAAAP/ACXgDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAJfAAAAAAJeAABAAAAAAAAAAAAAAAAAAAAFAQAAAAAAAAAAAAAAAIAAAAEBABpBAAAGAQAAJEEAACsBAAAeAQAAQIEAAEABAAABwQAAJ4EAACtBAAAfQQAAIoEAABQCXwABAPjAAQEAABEAAAAAAAKABQAHgEMAYQB2gNuA6ADzAP4EOoRvhICEjISmhNUFVoWOBaaAAAAAQAAABQLdwAOAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('truetype');}[class*=" icon-"],[class^=icon-] { text-transform: none; font-weight: 400; font-style: normal; font-variant: normal; font-family: icomoon; line-height: 1; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}

CSS自适应

@media(max-width:880px){#qr {z-index: 10;display: none;position: absolute;background: #fff;right: 22%;top: -290%;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px}}

JS

$(function(a) { a("body").on("click", function(b) { var c = a(b.target).attr("class") || "", d = a(b.target).attr("rel") || ""; if (c || d) switch (!0) { case - 1 != c.indexOf("icon-wechat") : a(".icon-wechat").hasClass("tg") ? a("#qr").toggle() : (a(".icon-wechat").addClass("tg"), a("#qr").qrcode({ width: 128, height: 128, text: location.href }).toggle()); } });});

JS补充

通过邮件评论链接直接访问过来的网址会带评论后缀,如果此时扫描二维码会直接链接到评论位置,在 灰狼大神 的指点下,需要提取文章网址而不是地址栏网址,所以修改了部分代码。

text: location.href //这里需修改text: $("link[rel=canonical]").attr("href")

JS调用

<script type='text/javascript' src=".../jquery.qrcode.min.js"></script>

代码来源:GitHub

20 thoughts on “给文章底部添加了微信二维码和weibo分享

  1. Klose说道:

    Chrome 微信失效。

    1. 小五说道:

      @Klose 是呀,是有这个问题,刷新一下才有,还没找到解决办法~大神能否指点一下?

      1. Klose说道:

        @小五 = =并不会.要不你考虑用Hover的方式?

        1. 小五说道:

          @Klose 主要是二维码是靠js生成的,已经测试过了js点击隐藏显示div层和css隐藏显示div层,在runjs/code编辑器里测试正常,但是只要上传到空间,结果要么就是qrcode is not a function,要么就是Cannot read property ‘length’ of undefined。我觉得有可能是pjax加载主页的时候没让加载qrcode的js。

  2. 灰狼说道:

    从首页进来,点击,会报错:a(“#qr”).qrcode is not function。。。
    只有刷新一次页面才可以点出来

    1. 小五说道:

      @灰狼 对对对,就是这个,昨天一直出现这个问题,但是今天我用两个浏览器轮流试了,没发现这个问题。

  3. 灰狼说道:

    微信按钮点了无反应

    1. 小五说道:

      @灰狼 浏览器不兼容?我用谷歌和百度两个浏览器可以点开的。

      1. 灰狼说道:

        @小五 可以了,你更新了css,没有刷新到。刚才强刷页面可以了。。。

        1. 小五说道:

          @灰狼 我昨天下午测试的时候,是有碰到如果不强制刷新,会导致调用不了生成二维码的qrcode,不过今天貌似来回N次没发现问题。

      2. 灰狼说道:

        @小五 看了下代码,就不应该获取地址栏的地址,应该是获取文章的URL,不然我刚才测试的时候,地址栏是评论区域的地址,在微信上就会跳转到评论的位置(其实应该是直接看文章,从文章那里开始)

        1. 小五说道:

          @灰狼 诶,是哦,那怎么改啊?求大神指点,js我一窍不通。

          1. 灰狼说道:

            @小五 用$(“link[rel=canonical]”).attr(“href”)去获取文章的URL。

            1. 小五说道:

              @灰狼 谢谢灰狼大神~太感谢了。

  4. 故事会说道:

    博主貌似是程序员、、、、

    1. 小五说道:

      @故事会 0,0 额,还真是猜错了,做博客只是爱好,我不会写代码的。

  5. 自定义说道:

    你经营两个博客呀,之前去过那个博客,没仔细看域名。

    1. 小五说道:

      @自定义 哈哈~谈不上经营,另一个博客是因为朋友有个空间弃用了,我征用来的。帮我表妹发布文章的,可惜表妹不给力,文章写不出来,我也就没更新了,域名也只一年的。

      1. 自定义说道:

        @小五 额额,可以的,有余力就弄弄,毕竟风格不一样嘛。

        1. 小五说道:

          @自定义 那个博客几乎没啥整的地方,主题制作人很用心。我唯一没搞明白的就是在文章页面,点击壁纸按钮之后,壁纸下载按钮调不出来,有空再研究吧。

发表评论

电子邮件地址不会被公开。 必填项已用*标注