Dynamically load animations.
This makes sure that we don't have to serve the open animation when the bar is actually closed.
This commit is contained in:
10
src/index.js
10
src/index.js
@@ -1,12 +1,14 @@
|
||||
import "./style.scss";
|
||||
import {startClosedAnimation} from "./closed";
|
||||
import {startOpenAnimation} from "./open";
|
||||
|
||||
window.addEventListener('load', function () {
|
||||
if (document.body.classList.contains('open')) {
|
||||
startOpenAnimation();
|
||||
import("./open").then(function (module) {
|
||||
module.startOpenAnimation();
|
||||
});
|
||||
} else {
|
||||
startClosedAnimation();
|
||||
import("./closed").then(function (module) {
|
||||
module.startClosedAnimation();
|
||||
});
|
||||
}
|
||||
|
||||
doIfAuthorized(showToggleButton);
|
||||
|
||||
Reference in New Issue
Block a user