Fixed the location enumeration for the alerts

This commit is contained in:
Nico Opiyo 2019-02-12 13:19:44 +03:00
parent fe431b2b2c
commit 5e46c4f346

View File

@ -38,9 +38,9 @@ var HorizontalAlign = {
* Vertical alignment enumeration * Vertical alignment enumeration
*/ */
var VerticalAlign = { var VerticalAlign = {
Top: "0", Top: "top",
Middle: "1", Middle: "middle",
Bottom: "2" Bottom: "bottom"
}; };
/** /**
@ -481,19 +481,19 @@ var Display = {
var alertBackground = $("#alert-background")[0]; var alertBackground = $("#alert-background")[0];
switch (location) { switch (location) {
case VerticalAlign.Top: case AlertLocation.Top:
alertBackground.style.bottom = ''; alertBackground.style.bottom = '';
alertBackground.style.top = '0px'; alertBackground.style.top = '0px';
alertBackground.style.height = "25%"; alertBackground.style.height = "25%";
alertBackground.style.transition = "2s linear"; alertBackground.style.transition = "2s linear";
break; break;
case VerticalAlign.Middle: case AlertLocation.Middle:
alertBackground.style.top = ((window.innerHeight - alertBackground.clientHeight) / 2) + 'px'; alertBackground.style.top = ((window.innerHeight - alertBackground.clientHeight) / 2) + 'px';
alertBackground.style.height = "25%"; alertBackground.style.height = "25%";
alertBackground.classList.add("middle-entrance-animation"); alertBackground.classList.add("middle-entrance-animation");
Display._animationState = AnimationState.FadeInAnimation; Display._animationState = AnimationState.FadeInAnimation;
break; break;
case VerticalAlign.Bottom: case AlertLocation.Bottom:
default: default:
alertBackground.style.top = ''; alertBackground.style.top = '';
alertBackground.style.bottom = '0px'; alertBackground.style.bottom = '0px';
@ -514,11 +514,11 @@ var Display = {
var alertBackground = $("#alert-background")[0]; var alertBackground = $("#alert-background")[0];
if (location == VerticalAlign.Top || location == VerticalAlign.Bottom) { if (location == AlertLocation.Top || location == AlertLocation.Bottom) {
alertBackground.style.height = "0%"; alertBackground.style.height = "0%";
alertBackground.style.transition = '2s linear'; alertBackground.style.transition = '2s linear';
} }
else if (location == VerticalAlign.Middle) { else if (location == AlertLocation.Middle) {
alertBackground.classList.add("middle-exit-animation"); alertBackground.classList.add("middle-exit-animation");
alertBackground.style.height = "0%"; alertBackground.style.height = "0%";
Display._animationState = AnimationState.FadeOutAnimation; Display._animationState = AnimationState.FadeOutAnimation;