Files
Backend-Api/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/PrintOne.js

31 lines
944 B
JavaScript

if (window.matchMedia('(max-width: 767px)').matches) {
$(document).ready(function () {
window.onbeforeprint = (event) => {
$("#MainModal").modal("hide");
}
document.getElementById("MainModal").style.visibility = "hidden";
setTimeout(function () {
printElement(document.getElementById("printThis"));
}, 500);
});
} else {
document.getElementById("btnPrint").onclick = function () {
printElement(document.getElementById("printThis"));
}
}
function printElement(elem) {
var domClone = elem.cloneNode(true);
var $printSection = document.getElementById("printSection");
if (!$printSection) {
$printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
}
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
}