mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(dom) scrollIntViewIfNeeded: add second param
This commit is contained in:
parent
23f61acfb9
commit
8b42f0a659
2 changed files with 12 additions and 3 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue