diff --git a/package.json b/package.json index a899871..e70b5d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "epubjs", - "version": "0.3.64", + "version": "0.3.65", "description": "Parse and Render Epubs", "main": "lib/index.js", "module": "src/index.js", diff --git a/src/managers/helpers/stage.js b/src/managers/helpers/stage.js index eff62a8..a0325be 100644 --- a/src/managers/helpers/stage.js +++ b/src/managers/helpers/stage.js @@ -198,11 +198,23 @@ class Stage { // Bounds not set, get them from window let _windowBounds = windowBounds(); + let bodyStyles = window.getComputedStyle(document.body); + let bodyPadding = { + left: parseFloat(bodyStyles["padding-left"]) || 0, + right: parseFloat(bodyStyles["padding-right"]) || 0, + top: parseFloat(bodyStyles["padding-top"]) || 0, + bottom: parseFloat(bodyStyles["padding-bottom"]) || 0 + }; + if (!width) { - width = _windowBounds.width; + width = _windowBounds.width - + bodyPadding.left - + bodyPadding.right; } if (this.settings.fullsize || !height) { - height = _windowBounds.height; + height = _windowBounds.height - + bodyPadding.top - + bodyPadding.bottom; } return {