У меня есть таблица из 50 строк внутри элемента div (divbody ниже), которую мне нужно распечатать. При использовании printThis.js я могу распечатать только одну страницу. Это мой код для печати:
Код: Выделить всё
$('#printButton').click (function() {
var divBodyElement = $('#divbody').clone(true);
var divBodyElementFind = divBodyElement.find(); divBodyElementFind.addBack(divBodyElement);
divBodyElementFindWithAddBackScrollHidden = divBodyElementFindWithAddBack.css('overflow','hidden');
$(divBodyElementFindWithAddBackScrollHidden).printThis();
return true;
This works except only one page prints and its cut off right where the scroll bar ends. Any thoughts on how to fix?
I can only print one page.
Ok, to answer my own question, I just needed the children, not the parent. With the following, printThis now prints multiple pages more or less correctly.
Код: Выделить всё
var divBodyElement = $('#divbody').clone(true);
var divBodyElementChildren = divBodyElement.children();
$(divBodyElementChildren).printThis();
Источник: https://stackoverflow.com/questions/781 ... intthis-js
Мобильная версия