Is there a way that I can delay the drawer opening by a second or so until it loads the body fully? I am using an embed in my drawer and sometimes the javascript to insert the src in the body of the drawer is delayed and causes a whitescreen drawer. Wanting to add this into the scripts.bundle.js of the drawer handling.
kt_drawer_example_dismiss
Hi,
This requirement can be done by populating the drawer content before showing it. You can attach an click event handler for a button and upon click you can load the content for the drawer body and display it via API:
var drawerToggle = document.querySelector("#kt_drawer_example_1_toggle");
var drawerElement = document.querySelector("#kt_drawer_example_1");
var drawer = KTDrawer.getInstance(drawerElement);
var drawerBodyElement = drawerElement.queryString("#kt_drawer_example_1_body");
object.addEventListener("click", myScript);
var contentLoaded = false;
drawerToggle.addEventListener("click", function() {
if (contentLoaded === false) {
drawerBodyElement.innerHTML = "Drawer content";
}
drawer.show();
});
Hi,
May I know which drawer are you referring to? Also to customize the theme JS code you will need to edit the code in "src/js" and compile the changes into the assets folder. You should not edit scripts.bundle.js directly since it's compiled and minified code for production.
Please refer to to this Gulp Build Tools page to get starged with Craft assets management.
Regards