Skip to content

This plugin publishes jQuery events before and after print

License

Notifications You must be signed in to change notification settings

dubbs/jquery-printevents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Print Events

This plugin publishes jQuery events before and after print. It normalizes onbeforeprint/onafterprint and window.matchMedia using techniques described in this article.

Usage

Include dependencies:

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script src="jquery.printevents.js"></script>

Create subscribers for the published events:

$(document).on('print:before', function () {
  // run code before print
});

$(document).on('print:after', function () {
  // run code after print
});