页面浮动当前Url二维码

来源:互联网 发布:网络爬虫工具排名 编辑:程序博客网 时间:2024/05/29 08:30

右下角浮动 二维码

//函数//config.width  二维宽度//config.height  二维高度//maxScreen 当屏幕宽度小于这个值时 不显示 二维码。function qrcodeFloat(config){    if(config==null){config={};}    if(config.width==null){config.width=100;config.height=100;}    if(config.height==null){config.height=100;}    if(config.maxScreen==null){config.maxScreen=1000;}    if(config.message==null){config.message="扫码手机访问";}    //qrcode    document.write('<script src="http://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js" ><\/script>');    document.write('<style type="text/css">#qrocdeContainer{position: fixed;z-index: 999;bottom: 0;left: 0;width: 100%;width:100%;}#qrcodeMessage{background:#fff;width:'+config.width+'px;padding:8px;text-align:center;float:right;}@media screen and (max-width: '+config.maxScreen+'px) {#qrocdeContainer{display:none;}}</style>')    document.write('<div id="qrocdeContainer"><div id="qrcodeMessage"><div id="qrcode"></div><div>'+config.message+'</div></div></div>')    $(function(){var content=document.location.href;   jQuery('#qrcode').qrcode({width:config.width,height:config.height,correctLevel:0,text:content});});}//调用方法:qrcodeFloat({width:120,height:120});

效果图:
这里写图片描述

0 0
原创粉丝点击