JQuery printElement在Internet Explorer中打印整个页面
我正在使用以打印div的内容 它在Safari、Chrome和Firefox上运行得非常好,但当我尝试使用Internet Explorer(所有版本)时,它会打印整个页面,而不是只打印div。为什么呢?我能做什么 以下是用于打印的代码:JQuery printElement在Internet Explorer中打印整个页面,jquery,internet-explorer,html,printing,Jquery,Internet Explorer,Html,Printing,我正在使用以打印div的内容 它在Safari、Chrome和Firefox上运行得非常好,但当我尝试使用Internet Explorer(所有版本)时,它会打印整个页面,而不是只打印div。为什么呢?我能做什么 以下是用于打印的代码: $('.print_button').each(function() { $(this).click(function() { $(this).closest('.details').find('.div_to_print').prin
$('.print_button').each(function() {
$(this).click(function() {
$(this).closest('.details').find('.div_to_print').printElement({
pageTitle: '...',
overrideElementCSS: [
'<?php echo stylesheet_path("print.css"); ?>'
]
});
});
});
$('.print_按钮')。每个(函数(){
$(此)。单击(函数(){
$(this).closest('.details').find('.div_to_print').printElement({
页面标题:“…”,
覆盖元素CSS:[
''
]
});
});
});
您是否尝试过简单使用CSS:
@media print {
.element-not-to-print {
display: none;
}
}
或
对媒体查询的支持是IE9+:
对于IE7和IE8,请使用检查。或者直接切入点,添加到项目中,继续使用良好的旧媒体查询,这不会像jQuery那样影响性能
@media print {
.element-not-to-print {
visibility: hidden;
}
}