Coder Social home page Coder Social logo

qrcodejs's Introduction

QRCode.js

QRCode.js is javascript library for making QRCode. QRCode.js supports Cross-browser with HTML5 Canvas and table tag in DOM. QRCode.js has no dependencies.

Basic Usages

<div id="qrcode"></div>
<script type="text/javascript">
new QRCode(document.getElementById("qrcode"), "http://jindo.dev.naver.com/collie");
</script>

or with some options

<div id="qrcode"></div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
//二维码内容	
	text: "http://jindo.dev.naver.com/collie",
//二维码宽度
	width: 128,
//二维码高度
	height: 128,
//二维码前景色
	colorDark : "#000000",
//二维码背景色
	colorLight : "#ffffff",
//容错级别
	correctLevel : QRCode.CorrectLevel.H
});
</script>

新增选项

var qrcode = new QRCode('qrcode', {
//二维码内容
  text: 'your content',
//二维码宽度
  width: 125,
//二维码高度
  height: 125,
//二维码前景色
  colorDark : '#000000',
//二维码背景色
  colorLight : "#fff",
  /*!
	容错级别,可设置为:
	QRCode.CorrectLevel.L
	QRCode.CorrectLevel.M
	QRCode.CorrectLevel.Q
	QRCode.CorrectLevel.H
  */
  correctLevel : QRCode.CorrectLevel.L,
//二维码中心图片
  iconSrc: "http://www.365mini.com/static/image/cry.gif",
//二维码中心图片边框弧度
  iconRadius: 10,
//二维码中心图片边框宽度
  iconBorderWidth: 3,
//二维码中心图片边框颜色
  iconBorderColor: "red",
//外围幕布(或画布)的宽度
  curtainWidth: 300,
//外围幕布(或画布)的高度
  curtainHeight: 300,
//外围幕布(或画布)图片
  curtainImg: "qrcode_border.png",
//外围幕布(或画布)底色
  curtainBgColor: "Wheat",
//二维码相对外围幕布(或画布)的X偏移
  qrcodeOffsetX: 88,
//二维码相对外围幕布(或画布)的Y偏移
  qrcodeOffsetY: 108,
});

and you can use some methods

qrcode.clear(); // clear the code.
qrcode.makeCode("http://naver.com"); // make another code.

Browser Compatibility

IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile, ETC.

License

MIT License

Contact

twitter @davidshimjs

Bitdeli Badge

Online Demo

Online Demo

qrcodejs's People

Contributors

555chy avatar davidshimjs avatar davidcl64 avatar dwilkie avatar tptee avatar ysangkok avatar trianman avatar bitdeli-chef avatar evanhahn avatar pirosikick avatar lukem512 avatar ghigo avatar markvantilburg avatar sailxjx avatar taku0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.