Created
January 14, 2011 09:03
-
-
Save shameerc/779384 to your computer and use it in GitHub Desktop.
jQuery code to generate qr code for 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
| <html> | |
| <head> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| (function($){ | |
| $.fn.qr = function(){ | |
| var url = $(this).attr('href'); | |
| var size= 4; | |
| return 'http://qrcode.kaywa.com/img.php?s='+size+'&d='+url; | |
| }; | |
| })(jQuery); | |
| $(document).ready(function(){ | |
| $('.qr').hover(function(){ | |
| var qrcode = $(this).qr(); | |
| $('#qrimg').html('<img src="'+qrcode+'">'); | |
| }) | |
| $('.qr').mouseout(function(){ | |
| $('#qrimg').html(''); | |
| }) | |
| }) | |
| </script> | |
| </head> | |
| <body> | |
| <a href="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" class="qr">JQuery</a> | |
| <br/><br/><br/> | |
| <a href="http://code.google.com/apis/chart/docs/gallery/qr_codes.html" class="qr">JQuery</a> | |
| <div id="qrimg"></div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment