Outlook feed
To implement the printing function, the button does not need to be printed. When you hide the button before using print directly, the button will not appear when you click to cancel printing.
How to achieve
//beforePrint 打印前将按钮隐藏
afterPrint 取消时将按钮回显
其他内容可以完全复制,就可以用
var beforePrint = function() {
$("#exportZghfd").hide()
$("#dyZghfd").hide()
$("#from_btns").hide()
};
var afterPrint = function() {
$("#exportZghfd").show()
$("#dyZghfd").show()
$("#from_btns").show()
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
$("#dyZghfd").click(function () {
window.print();
})