Javascript windows chrome中的打印功能导致站点故障
我正在建立一个网站,其中有一个画廊,在每个图像,我们有一个更大的图像显示点击 我们还可以选择在facebook上分享和打印 打印功能通过调用浏览器打印功能完成:Javascript windows chrome中的打印功能导致站点故障,javascript,jquery,windows,google-chrome,Javascript,Jquery,Windows,Google Chrome,我正在建立一个网站,其中有一个画廊,在每个图像,我们有一个更大的图像显示点击 我们还可以选择在facebook上分享和打印 打印功能通过调用浏览器打印功能完成: $("#print").on(isMobile.any() ? 'touchend' : 'click', function (e) { var printWindow = window.open('', 'Print Window', 'height=400,width=700'); printWindow.docu
$("#print").on(isMobile.any() ? 'touchend' : 'click', function (e) {
var printWindow = window.open('', 'Print Window', 'height=400,width=700');
printWindow.document.write('<html><head><title>Print Window</title>');
printWindow.document.write('</head><body ><img src=\'');
printWindow.document.write($(".large-img").attr("src"));
printWindow.document.write('\' /></body></html>');
printWindow.document.close();
printWindow.print();
});
$(“#打印”).on(isMobile.any()?“touchend”:“click”,函数(e){
var printWindow=window.open(“”,'打印窗口','高度=400,宽度=700');
printWindow.document.write('Print Window');
printWindow.document.write(“”);
printWindow.document.close();
printWindow.print();
});
关闭打印窗口后,图像停止加载(单击下一步按钮)
windows chrome打印功能是否存在任何已知问题
链接:链接已删除
注意:该网站在windows Firefox(即Ubuntu中的Chrome)上运行良好。不幸的是,它似乎是一个Chrome bug: 我建议您使用css打印样式表,而不是打开弹出窗口,例如:
@media print{
body{
background:#ffffff;
}
.header, .gallety-content, .close-btn, .control-nav, .footer, .bottom-line{
display:none;
}
.middle-content{
background:none;
}
.gallery-overlay{
left:0;
top:0;
position:relative;
}
.glry-large-img{
left:0;
top:0;
position:relative;
margin:0 auto;
width:100%;
}
}
希望有帮助嗨,谢谢@Mario Bellart