IMPR: UI Header shink

This commit is contained in:
Tony Air 2020-08-04 04:15:00 +07:00
parent f085fb1c21
commit 6e3e8e1e17
4 changed files with 37 additions and 16 deletions

View File

@ -283,7 +283,7 @@ const AjaxUI = (($) => {
}*/ }*/
}, },
restoreAll: () => { restoreAll: () => {
for (const url in $.xhrPool.requests) { for (let url in $.xhrPool.requests) {
const jqXHR = $.xhrPool.requests[url]; const jqXHR = $.xhrPool.requests[url];
$.ajax(jqXHR.opts); $.ajax(jqXHR.opts);
console.log(`AJAX request is restored (${jqXHR.opts.url})`); console.log(`AJAX request is restored (${jqXHR.opts.url})`);

View File

@ -1,15 +1,34 @@
"use strict"; 'use strict';
import $ from 'jquery'; import $ from 'jquery';
import Events from '../_events';
const ShrinkUI = (($) => { const ShrinkUI = (($) => {
// Constants // Constants
const G = window; const W = window;
const D = document; const D = document;
const NAME = 'ShrinkUI';
// shrink bar console.log(`${NAME}: init`);
$(G).scroll(() => {
if ($(D).scrollTop() > 100) { $(W).on(`${Events.LOADED} ${Events.SCROLL} ${Events.RESIZE}`, () => {
let h1 = $('#SiteWideMessage').height();
if (!h1) {
h1 = 0;
}
let h2 = $('#SiteWideOffline').height();
if (!h2) {
h2 = 0;
}
let h3 = $('#Header').height();
if (!h3) {
h3 = 0;
}
const headerHeight = h1 + h2 + h3;
if ($(D).scrollTop() > headerHeight) {
$('body').addClass('shrink'); $('body').addClass('shrink');
} else { } else {
$('body').removeClass('shrink'); $('body').removeClass('shrink');

View File

@ -89,7 +89,7 @@ const MainUI = (($) => {
}; };
W.addEventListener( W.addEventListener(
'offline', `${Events.OFFLINE}`,
() => { () => {
updateOnlineStatus(); updateOnlineStatus();
}, },
@ -97,14 +97,14 @@ const MainUI = (($) => {
); );
W.addEventListener( W.addEventListener(
'online', `${Events.ONLINE}`,
() => { () => {
updateOnlineStatus(); updateOnlineStatus();
}, },
false, false,
); );
W.addEventListener('load', () => { W.addEventListener(`${Events.LOADED}`, () => {
updateOnlineStatus(); updateOnlineStatus();
}); });
@ -430,7 +430,7 @@ const MainUI = (($) => {
AjaxUI.preload([lazySrc]).then(() => { AjaxUI.preload([lazySrc]).then(() => {
$el.attr('src', lazySrc); $el.attr('src', lazySrc);
$el.on('load', () => { $el.on(`${Events.LOADED}`, () => {
$el.addClass('loaded'); $el.addClass('loaded');
$el.removeClass('loading'); $el.removeClass('loading');
@ -491,7 +491,7 @@ const MainUI = (($) => {
MainUI.init(); MainUI.init();
}); });
$(W).on('resize', () => { $(W).on(`${Events.RESIZE}`, () => {
MainUI.detectBootstrapScreenSize(); MainUI.detectBootstrapScreenSize();
}); });

View File

@ -71,7 +71,7 @@ body.cms {
display: none; display: none;
} }
.mce-edit-area { /*.mce-edit-area {
height: 5em; height: 5em;
iframe { iframe {
height: 5em !important; height: 5em !important;
@ -79,16 +79,17 @@ body.cms {
} }
.form-control.textarea { .form-control.textarea {
height: 13.5em; height: 13.5em;
} }*/
} }
.fields-row { .fields-row {
margin: 0 !important; margin: 0 !important;
padding: 0; padding: 0 0 2em !important;
width: 90%; width: 100%;
.form__fieldgroup { .form__fieldgroup {
margin: 0 !important; margin: 0 !important;
padding: 0; padding: 0 !important;
width: 100% !important; width: 100% !important;
max-width: 100% !important; max-width: 100% !important;
flex: 0 0 100% !important; flex: 0 0 100% !important;
@ -96,6 +97,7 @@ body.cms {
flex-wrap: wrap; flex-wrap: wrap;
> .form-group { > .form-group {
padding: 0 1rem; padding: 0 1rem;
margin: 0 !important;
flex: 1 1 50%; flex: 1 1 50%;
max-width: 50%; max-width: 50%;
} }