Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix iOS scrolling issue on clone

commit 98ee30643ab707b32cb95cd8103105902a9e8eb9 1 parent a49c3a2
@niklasvh authored
Showing with 13 additions and 3 deletions.
  1. +5 −0 dist/html2canvas.js
  2. +3 −3 dist/html2canvas.min.js
  3. +5 −0 src/clone.js
View
5 dist/html2canvas.js
@@ -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);
}
View
6 dist/html2canvas.min.js
3 additions, 3 deletions not shown
View
5 src/clone.js
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.