Skip to content

sainish/jQuery.EAN13

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#jQuery.EAN13 jQuery.EAN13 is a lightweight (~2kb) jQuery plugin for in-place generation of EAN-13 barcodes.

##Usage##

###Include Plugin### Insert the following code into the head section of you page:

<script type="text/javascript" src="jQuery.EAN13.min.js"></script>

Make sure to include this AFTER the jQuery-library.

###Insert Canvas### At the place where you want to insert the barcode insert this code:

<canvas id="ean" width="200" height="100">
	Your browser does not support canvas-elements.
</canvas>

You may change the dimensions of the element. The barcode will automatically be resized.

###Print barcode### For printing the code of the provided number with the number under it, just use the following code:

$("#ean").EAN13("9002236311036");

##Options##

###Without number### For only printing the barcode use the code below:

$("#ean").EAN13("9002236311036", {
	number: false
});

###Prefix### Set the prefix option to false to not print the country prefix:

$("#ean").EAN13("9002236311036", {
	prefix: false
});

###Color### Set the color option to a color to print the barcode with it.

####Hex-value####

$("#ean").EAN13("9002236311036", {
	color: "#f00"
});

####RGB-value####

$("#ean").EAN13("9002236311036", {
	color: "rgb(255,0,0)"
});

####RGBA-value####

$("#ean").EAN13("9002236311036", {
	color: "rgb(255,0,0,0.2)"
});

##Callbacks##

###onValid### When the code is valid, the onValid callback gets executed.

$("#ean").EAN13("9002236311036", {
	onValid: function(){
		// do
	}
});

###onInvalid### When the code is invalid, the onInvalid callback gets executed.

$("#ean").EAN13("9002236311036", {
	onInvalid: function(){
		// do
	}
});

###onError### When the plugin (canvas-element) is not supported by the browser onError gets called.

$("#ean").EAN13("9002236311036", {
	onError: function(){
		// do
	}
});

##Author## Johannes Mittendorfer (http://johannes-mittendorfer.com)

About

A jQery Plugin for generating EAN13-barcodes

Resources

License

Stars

Watchers

Forks

Packages

No packages published