Fix iOS scrolling issue on clone

This commit is contained in:
Niklas von Hertzen 2015-03-30 00:58:50 +03:00
parent a49c3a2320
commit 98ee30643a
3 changed files with 13 additions and 3 deletions

5
dist/html2canvas.js vendored
View File

@ -1625,6 +1625,11 @@ module.exports = function(ownerDocument, containerDocument, width, height, optio
clearInterval(interval);
if (options.type === "view") {
container.contentWindow.scrollTo(x, y);
if ((/(iPad|iPhone|iPod)/g).test(navigator.userAgent) && (container.contentWindow.scrollY !== y || container.contentWindow.scrollX !== x)) {
documentClone.documentElement.style.top = (-y) + "px";
documentClone.documentElement.style.left = (-x) + "px";
documentClone.documentElement.style.position = 'absolute';
}
}
resolve(container);
}

File diff suppressed because one or more lines are too long

View File

@ -84,6 +84,11 @@ module.exports = function(ownerDocument, containerDocument, width, height, optio
clearInterval(interval);
if (options.type === "view") {
container.contentWindow.scrollTo(x, y);
if ((/(iPad|iPhone|iPod)/g).test(navigator.userAgent) && (container.contentWindow.scrollY !== y || container.contentWindow.scrollX !== x)) {
documentClone.documentElement.style.top = (-y) + "px";
documentClone.documentElement.style.left = (-x) + "px";
documentClone.documentElement.style.position = 'absolute';
}
}
resolve(container);
}