前端开发

 首页 > 前端开发 > jquery教程 > 生成二维码的 jQuery 插件:jquery.qrcode.js

生成二维码的 jQuery 插件:jquery.qrcode.js

分享到:
【字体:
导读:
         [导读] jquery.qrcode.js 是一个纯浏览器 生成 QRcode 的 jQuery 插件,它使用非常简单,生成的 QRcode 无需下载图片,并且不依赖第三方服务,比如最近 Google 服务在国内访问不稳就造成我好几个网站...

jquery.qrcode.js 是一个纯浏览器 生成 QRcode 的 jQuery 插件,它使用非常简单,生成的 QRcode 无需下载图片,并且不依赖第三方服务,比如最近 Google 服务在国内访问不稳就造成我好几个网站的 QRcode 不能使用,并且压缩之后大小小于 4K。


jquery.qrcode.js 使用


1. 加载 jQuery 和 jquery.qrcode.js:


2. 创建一个用于包含 QRcode 图片的 DOM 元素,比如 div:


3. 然后通过下面代码生成 QRcode:


jQuery('#qrcode').qrcode("http://blog.wpjam.com");

4. 默认生成的二维码大小是 256×256,当然可以自定义大小:


jQuery('#qrcode').qrcode({width: 64,height: 64,text: "http://blog.wpjam.com"});

jquery.qrcode.js 演示


1. Canvas 方式渲染

blob.png


2. Table 方式渲染,并加了 1px 描边。

blob.png

分享到:
js图片等比例缩放
//图片比例缩放控制 www.zixuephp.com function DrawImage(ImgD,FitWidth,FitHeight){      var image=new Image();      image.src=ImgD.src;      if(image.width>0 && image.height>0)      {          if(image.width/image.height>= FitWidth/FitHeight)          ...
解决IE中img.onload失效的方法
原来 $("#QrCode").on("load",function(){     $(".loading").hide();     alert(1); }) //或者 document.getElementById("QrCode").onload = function(){     $(".loading").hide();     alert(1); } 看起来没什么问题,但是为什么onload在ie下经常没有被调用呢?因为浏览器会缓存图片,第二次加载的图片不是从...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……