forked from UKSOURCE/cms.hailearning.edu.vn
add api headermenu and crud management
This commit is contained in:
31
public/js/custom-modal.js
Normal file
31
public/js/custom-modal.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Custom Modal Utilities
|
||||
*/
|
||||
|
||||
// Global function to clean up any stuck modal backdrops
|
||||
window.forceCleanupModals = function() {
|
||||
document.body.classList.remove('modal-open');
|
||||
document.body.style.overflow = '';
|
||||
document.body.style.paddingRight = '';
|
||||
const backdrops = document.querySelectorAll('.modal-backdrop, .overlay, .loading');
|
||||
if (backdrops.length > 0) {
|
||||
console.warn('Cleanup: Removing backdrops:', backdrops.length);
|
||||
backdrops.forEach(el => el.remove());
|
||||
}
|
||||
};
|
||||
|
||||
// Auto-cleanup on hide
|
||||
document.addEventListener('hidden.bs.modal', () => {
|
||||
setTimeout(forceCleanupModals, 100);
|
||||
});
|
||||
|
||||
// Watchdog
|
||||
setInterval(() => {
|
||||
if (document.querySelectorAll('.modal.show').length === 0) {
|
||||
if (document.querySelectorAll('.modal-backdrop').length > 0) {
|
||||
forceCleanupModals();
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
window.addEventListener('load', forceCleanupModals);
|
||||
Reference in New Issue
Block a user