Home >Web Front-end >Front-end Q&A >What to do if jquery printing is incomplete

What to do if jquery printing is incomplete

藏色散人
藏色散人Original
2023-02-17 10:00:492047browse

Solution to incomplete jquery printing: 1. Open the corresponding js file; 2. Change the overflow of the specified div to display all before printing, and modify the code to "$('#print').css ({'height' : 'auto','overflow' : 'visible'}).print();".

What to do if jquery printing is incomplete

The operating environment of this tutorial: Windows 10 system, jquery3.2.1 version, Dell G3 computer.

What should I do if jquery prints incompletely?

jquery.print plug-in prints the problem of incomplete display when printing the specified part

When the height or width of the div to be printed is very large and has a scroll bar, only a part of it can be printed. , many other things in the scroll bar cannot be printed. I have tried many methods. This is the best one I have found so far. I will record it.

$('#print').print({ // 要打印部分的id
    noPrintSelector: '.noPrint'  // 不打印部分 具体看参数配置
})
 
 //改成
$('#print').css({
   'height' : 'auto', //高度自动
   'overflow' : 'visible' //在打印之前把这个div的overflow改成全部显示
}).print(); 
 
// 打印结束后再改回之前样式, 还有种办法就是单独写一个css文件
 
//print.css
//里面包含
#print{
    height:auto;
    overflow:visible;
}
//这样
//在html头部 <link rel="stylesheet/css" href="print.css" media="print">

Related introduction:

jQuery is a fast and concise JavaScript framework. It is another excellent JavaScript code library (framework) after Prototype. It was released by John Resig in January 2006. The purpose of jQuery's design is "write less, do more", which means writing less code and doing more things. It encapsulates common JavaScript function codes, provides a simple JavaScript design pattern, and optimizes HTML document operations, event processing, animation design and Ajax interaction.

The core features of jQuery can be summarized as follows: It has a unique chain syntax and a short and clear multi-functional interface; it has an efficient and flexible CSS selector, and can expand the CSS selector; it has convenient plug-in extensions Mechanism and rich plug-ins. jQuery is compatible with various mainstream browsers, such as IE 6.0, FF 1.5, Safari 2.0, Opera 9.0, etc.

Recommended learning: "jQuery Video Tutorial"

The above is the detailed content of What to do if jquery printing is incomplete. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn