Prevent dialog top from going past top of screen.
This commit is contained in:
Родитель
1feb2a504a
Коммит
fb258ba6c9
|
@ -15,6 +15,9 @@ var dialogPolyfill = (function() {
|
||||||
document.body.clientHeight :
|
document.body.clientHeight :
|
||||||
window.innerHeight,
|
window.innerHeight,
|
||||||
topValue = scrollTop + (windowHeight - element.offsetHeight) / 2;
|
topValue = scrollTop + (windowHeight - element.offsetHeight) / 2;
|
||||||
|
if (0 > topValue) {
|
||||||
|
topValue = 0;
|
||||||
|
}
|
||||||
element.style.top = topValue + 'px';
|
element.style.top = topValue + 'px';
|
||||||
element.dialogPolyfillInfo.isTopOverridden = true;
|
element.dialogPolyfillInfo.isTopOverridden = true;
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче