jquery print break-inside: avoid
jQuery break PRINT inside avoid
2023-06-13 09:12:11 时间
印刷结果预览
print area 为单位印刷
实装方式
HTML
<div class="level-item">
<button class="button is-black " id="print-all-btn"> <!-- 全体印刷 button-->
<span>印刷</span>
</button>
</div>
<!-- 全体印刷 范围 start-->
<div class="block print-all">
{% for key, supplier in supplier_dict.items %}
<div class="card-custom can-print"><!-- 个别印刷 范围 start-->
<div>
略
</div>
<div>
<button class="button is-black print-btn hideInPrint" > <!-- 印刷属性设定-->
<span>印刷</span>
</button>
</div>
</div><!-- 个别印刷 范围 end-->
{% endfor %}
</div><!-- 全体印刷 范围 end-->
印刷
<style>
//印刷 全部
$('#print-all-btn').on('click', function(e){
$('.print-all').print();
})
//印刷 個別
$('.print-btn').on('click', function(e){
$(this).closest('.can-print').print();
});
</style>
分页,指定area不截断,个别项目除外
<style>
.can-print {
break-inside: avoid; // 指定area不截断
}
@media print { // 指定area内、不印刷 (按钮,header,footer等 加上class hideInPrint)
.hideInPrint{
display: none;
}
}
</style>
相关文章
- jquery validation engine ajax验证,jQuery Validation Engine 表单验证「建议收藏」
- JQuery为textarea添加maxlength属性的代码
- jQuery对象与DOM对象之间的转换方法
- 基本jquery的控制tabs打开的数量的代码
- Jquery知识点三jquery表单对象操作
- jQuery参数列表集合
- 一个JQuery操作Table的代码分享
- jQuery学习笔记(2)--用jquery实现各种模态提示框代码及项目构架
- jQuery学习笔记(3)--用jquery(插件)实现多选项卡功能
- jquery插件开发注意事项小结
- jquery.cookie()方法的使用(读取、写入、删除)
- jquery简单实现鼠标经过导航条改变背景图
- Jquery如何实现点击时高亮显示代码
- jquery判断元素是否隐藏的多种方法
- Jquery的each里用returntrue或false代替break或continue