diff --git a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js index 8b154ff..04b617d 100644 --- a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js +++ b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js @@ -2,12 +2,15 @@ var scale = 1, transformY = 0, selected = true; var html = document.getElementsByTagName('html')[0]; var wrapper = document.getElementById("wrapper"); + var fixedWrapper = document.createElement("div"); var fixedContainer = document.createElement('div'); fixedContainer.style.position = "absolute"; fixedContainer.style.top = "0"; fixedContainer.style.left = "0"; fixedContainer.style.width = "100%"; + document.body.appendChild(fixedWrapper); + fixedWrapper.appendChild(wrapper); wrapper.appendChild(fixedContainer); var jQuery = $ || window.jQuery; @@ -60,14 +63,15 @@ wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style["-ms-transform-origin"] = "top left"; fixedContainer.style.height = (document.body.clientHeight / scale) + "px"; - wrapper.style.overflowY = "hidden"; - document.body.style.overflowX = "hidden"; - document.body.style.overflowY = "auto"; + wrapper.style.overflowY = "auto"; html.style.backgroundColor = "#ffffff"; + document.body.style.overflowX = "hidden"; + document.body.style.overflowY = "auto"; + fixedWrapper.style.overflow = "hidden"; if (scale < 1) { - document.body.style.width = bounds.width + "px"; - document.body.style.height = bounds.height + "px"; + fixedWrapper.style.width = bounds.width * scale + "px"; + fixedWrapper.style.height = bounds.height * scale + "px"; } window.scale = window.devicePixelRatio * scale; @@ -84,12 +88,14 @@ wrapper.style.overflowY = "hidden"; wrapper.style.top = ""; fixedContainer.style.height = "0px"; - document.body.style.overflowX = "hidden"; - document.body.style.overflowY = "hidden"; html.style.backgroundColor = "#ffffff"; + document.body.style.overflow = "hidden"; document.body.style.width = "100%"; document.body.style.height = "100%"; + fixedWrapper.style.overflow = "hidden"; + fixedWrapper.style.width = "100%"; + fixedWrapper.style.height = "100%"; scale = 1; window.scale = window.devicePixelRatio / scale; diff --git a/src/main/resources/com/finebi/plugin/web/scripts/entry.js b/src/main/resources/com/finebi/plugin/web/scripts/entry.js index 8b154ff..04b617d 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -2,12 +2,15 @@ var scale = 1, transformY = 0, selected = true; var html = document.getElementsByTagName('html')[0]; var wrapper = document.getElementById("wrapper"); + var fixedWrapper = document.createElement("div"); var fixedContainer = document.createElement('div'); fixedContainer.style.position = "absolute"; fixedContainer.style.top = "0"; fixedContainer.style.left = "0"; fixedContainer.style.width = "100%"; + document.body.appendChild(fixedWrapper); + fixedWrapper.appendChild(wrapper); wrapper.appendChild(fixedContainer); var jQuery = $ || window.jQuery; @@ -60,14 +63,15 @@ wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style["-ms-transform-origin"] = "top left"; fixedContainer.style.height = (document.body.clientHeight / scale) + "px"; - wrapper.style.overflowY = "hidden"; - document.body.style.overflowX = "hidden"; - document.body.style.overflowY = "auto"; + wrapper.style.overflowY = "auto"; html.style.backgroundColor = "#ffffff"; + document.body.style.overflowX = "hidden"; + document.body.style.overflowY = "auto"; + fixedWrapper.style.overflow = "hidden"; if (scale < 1) { - document.body.style.width = bounds.width + "px"; - document.body.style.height = bounds.height + "px"; + fixedWrapper.style.width = bounds.width * scale + "px"; + fixedWrapper.style.height = bounds.height * scale + "px"; } window.scale = window.devicePixelRatio * scale; @@ -84,12 +88,14 @@ wrapper.style.overflowY = "hidden"; wrapper.style.top = ""; fixedContainer.style.height = "0px"; - document.body.style.overflowX = "hidden"; - document.body.style.overflowY = "hidden"; html.style.backgroundColor = "#ffffff"; + document.body.style.overflow = "hidden"; document.body.style.width = "100%"; document.body.style.height = "100%"; + fixedWrapper.style.overflow = "hidden"; + fixedWrapper.style.width = "100%"; + fixedWrapper.style.height = "100%"; scale = 1; window.scale = window.devicePixelRatio / scale;