diff --git a/lib/client/dom.js b/lib/client/dom.js index 347e23cc..1072c07c 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1767,12 +1767,19 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * unified way to scrollIntoViewIfNeeded * (native suporte by webkit only) * @param pElement + * @param pCenter */ - this.scrollIntoViewIfNeeded = function(pElement) { + this.scrollIntoViewIfNeeded = function(pElement, pCenter) { var lRet = pElement && pElement.scrollIntoViewIfNeeded; + /* for scroll as small as possible + * param should be false + */ + if (arguments.length === 1) + pCenter = false; + if (lRet) - pElement.scrollIntoViewIfNeeded(false); + pElement.scrollIntoViewIfNeeded(pCenter); return lRet; }; diff --git a/lib/client/polyfill.js b/lib/client/polyfill.js index fc142f29..f19949a9 100644 --- a/lib/client/polyfill.js +++ b/lib/client/polyfill.js @@ -107,7 +107,9 @@ var Util, DOM, jQuery; alignWithTop; if (window.getComputedStyle) { - centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded; + if (arguments.length === 1) + centerIfNeeded = false; + parent = pElement.parentNode; parentComputedStyle = window.getComputedStyle(parent, null);