Created
August 5, 2015 20:30
-
-
Save omurphy27/ae0393b3034cadd96fa3 to your computer and use it in GitHub Desktop.
JS / HTML open Link to Image in New Window and Print Image
This file contains 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
<!-- The Markup --> | |
<a href="http://tpp.jwdmc.com/wp-content/uploads/2015/07/15-percent-off.jpg" class="print-link" rel="shadowbox" >Print Coupon</a> | |
// The JS / Jquery | |
$('.print-link').on('click', function(e) { | |
e.preventDefault(); | |
$source = $(this).attr('href'); | |
win = window.open($source,"_blank"); | |
win.onload = function() { win.print(); } | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment