用起来很简单,页面中引入两个js:
<script type="text/javascript" src="https://www.tsingfun.com/statics/js/jquery.min.js"></script>
<script type="text/javascript" src="https://www.tsingfun.com/statics/qrcodejs/qrcode.min.js"></script>
然后使用方法如下:
<script type="text/javascript">
var qrcode = new QRCode("qrcode", {
text: 'https://m.tsingfun.com/', //URL地址
width: 180,
height: 180,
colorDark: '#088CEF', //二维码颜色
colorLight: "#ffffff" //背景颜色
});
$(function(){
$("#mob").hover(function() {
$("#qrcode").animate({opacity: "show"}, "slow");
}, function() {
$("#qrcode").animate({opacity: "hide"}, "fast");
});
})
</script>
搞定~