Created
July 19, 2012 20:51
-
-
Save elijahmanor/3146729 to your computer and use it in GitHub Desktop.
jQuery qrLinkify Plugin: Add QR codes next to anchor links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* jQuery qrLinkify Plugin: Add QR codes next to anchor links | |
| * Author: @elijahmanor | |
| * Example Usage: | |
| * $( "a" ).qrLinkify(); | |
| * $( "a" ).qrLinkify({ width: 250, height: 250 }); | |
| */ | |
| $.fn.qrLinkify = function( options ) { | |
| options = $.extend( {}, $.fn.qrLinkify.defaults, options ); | |
| return this.each( function( index ) { | |
| var $this = $( this ), | |
| url = $this.attr( "href" ); | |
| $( "<img />", { | |
| src: "https://chart.googleapis.com/chart?cht=qr&chl=" + escape( url ) + "&choe=UTF-8&chs=" + options.width + "x" + options.height | |
| }).insertAfter( $this ); | |
| }); | |
| }; | |
| $.fn.qrLinkify.defaults = { width: 100, height: 100 }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment