From 559d7b5d2c5b7cd5fee70781c3b6c5c3419e363b Mon Sep 17 00:00:00 2001 From: Degendra Sivakoti Date: Wed, 21 Sep 2016 17:29:04 +0545 Subject: [PATCH 1/2] set viewportsize equal to scrollHeight --- lib/webshot.phantom.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/webshot.phantom.js b/lib/webshot.phantom.js index 7147cdb..acd1a03 100644 --- a/lib/webshot.phantom.js +++ b/lib/webshot.phantom.js @@ -79,6 +79,16 @@ var _takeScreenshot = function(status) { return; } + //Work around for lazy loading web pages + var pageHeight = page.evaluate(function() { + return document.body.scrollHeight; + }); + + page.viewportSize = { + width: page.viewportSize.width, + height: pageHeight + } + // Wait `options.renderDelay` seconds for the page's JS to kick in window.setTimeout(function () { From 653c9dd3de4fde326e743dfbc540b11a43d843b1 Mon Sep 17 00:00:00 2001 From: Degendra Sivakoti Date: Wed, 21 Sep 2016 17:43:18 +0545 Subject: [PATCH 2/2] comment updated --- lib/webshot.phantom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/webshot.phantom.js b/lib/webshot.phantom.js index acd1a03..f9c04f6 100644 --- a/lib/webshot.phantom.js +++ b/lib/webshot.phantom.js @@ -79,7 +79,7 @@ var _takeScreenshot = function(status) { return; } - //Work around for lazy loading web pages + //Work around for parallax scrolling effects var pageHeight = page.evaluate(function() { return document.body.scrollHeight; });