日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

仿微信弹出二维码

發(fā)布時間:2023/12/8 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 仿微信弹出二维码 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

使用jquery插件生成二維碼,然后彈出它。

先在頁面引入:

<script src="./jquery-3.5.1.min.js"></script> <script src="./jquery.qrcode.min.js"></script>

這是彈出框主體:?

<div id="app"><p><a target="_blank" id="ercode">微信分享</a></p></div><div id="share_qrcode" class="share_qrcode"><div class="code_head"><span>保存二維碼,分享到微信朋友圈</span><p class="code_close" id="close">×</p></div><div id="code" class="code_main"></div><div class="code_foot"><p>掃一掃,打開網(wǎng)頁</p></div></div><script>$(function() {function popup(popupName) {var sHeight = $(document).scrollTop();var wHeight = $(window).height();var wWidth = $(window).width();var popupHeight = $('#share_qrcode').height();var popupWeight = $('#share_qrcode').width();var posiTop = (wHeight - popupHeight) / 2 + sHeight;var posiLeft = (wWidth - popupWeight) / 2;console.log("sHeight:" + sHeight + ",窗口寬度:" + wWidth + ",窗口高度:" + wHeight + ",popupHeight:" + popupHeight + ",popupWeight" + popupWeight)popupName.css({"left": posiLeft + "px"})}$('#ercode').click(function() {popup($('#share_qrcode'));$('#share_qrcode').fadeIn();});$('#close').on('click', function() {$('#share_qrcode').fadeOut();})})</script>

這個是生成二維碼的:

<script>//二維碼分享var url = window.location.href;$('#code').qrcode({text: url,render: "table", //table方式width: 200, //寬度height: 200, //高度}); </script>

這是彈出框樣式:

.share_qrcode {position: absolute;padding: 10px;width: 280px;height: 340px;background-color: #fff;border: 1px solid #d8d8d8;z-index: 990;font-size: 12px;display: none;left: 50%;}.share_qrcode .code_head {font-size: 12px;font-weight: bold;text-align: left;line-height: 16px;height: 16px;position: relative;color: #000;}.share_qrcode .code_close {width: 16px;height: 16px;position: absolute;right: 0;top: 0;color: #999;text-decoration: none;font-size: 16px;}.code_main {/* width: 200px; *//* height: 200px; */padding: 15px 10px;margin: 0 auto;}#code table {margin: 0 auto;}.code_foot {font-size: 12px;line-height: 22px;color: #666;text-align: left;}

總結(jié)

以上是生活随笔為你收集整理的仿微信弹出二维码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。