mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: add page loading (#274)
This commit is contained in:
1 parent
10e0600b0b
commit
4fad7a20bd
3 files changed
+15
No files matched your search
@@ -1,3 +1,14 @@
|
|||||||
|
.page-loader
|
||||||
|
position: absolute
|
||||||
|
top: 0
|
||||||
|
left: 0
|
||||||
|
right: 0
|
||||||
|
bottom: 0
|
||||||
|
display: flex
|
||||||
|
align-items: center
|
||||||
|
justify-content: center
|
||||||
|
z-index: 9999
|
||||||
|
|
||||||
.loader-container
|
.loader-container
|
||||||
position: absolute
|
position: absolute
|
||||||
left: 0
|
left: 0
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ console.log(
|
|||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
window.UiContext = JSON.parse(window.UiContext);
|
window.UiContext = JSON.parse(window.UiContext);
|
||||||
|
|
||||||
|
const PageLoader = '<div class="page-loader nojs--hide" style="display:none;"><div class="loader"></div></div>';
|
||||||
|
$('body').prepend(PageLoader);
|
||||||
|
$('.page-loader').fadeIn(500);
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
try { __webpack_public_path__ = UiContext.cdn_prefix; } catch (e) { }
|
try { __webpack_public_path__ = UiContext.cdn_prefix; } catch (e) { }
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ async function load() {
|
|||||||
shouldDelay: idx < 5, // only animate first 5 sections
|
shouldDelay: idx < 5, // only animate first 5 sections
|
||||||
$element: $(section),
|
$element: $(section),
|
||||||
}));
|
}));
|
||||||
|
$('.page-loader').hide();
|
||||||
console.log('done! %d ms', new Date().getTime() - start.getTime());
|
console.log('done! %d ms', new Date().getTime() - start.getTime());
|
||||||
for (const { $element, shouldDelay } of sections) {
|
for (const { $element, shouldDelay } of sections) {
|
||||||
$element.addClass('visible');
|
$element.addClass('visible');
|
||||||
|
|||||||
Reference in new issue
Block a user