Skip to content

Instantly share code, notes, and snippets.

@qwersk
Created June 6, 2017 02:09
Show Gist options
  • Save qwersk/30bf4629375579d0ee7fc37a5c9cbcb5 to your computer and use it in GitHub Desktop.
Save qwersk/30bf4629375579d0ee7fc37a5c9cbcb5 to your computer and use it in GitHub Desktop.
AFTER CLOSE PRINT WINDOW #JS #JAVASCRIPT
function close_print(){
var beforePrint = function() {
console.log('Functionality to run before printing.');
};
var afterPrint = function() {
//console.log('Functionality to run after printing');
$("#animal_menu, .single-subnav, #footer-credits-wrap, #mainpage-header, #print_button, .legend").show();
$(".park_map_page").css("width", 1170);
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment