Initial commit
This commit is contained in:
25
static/js/fix-dropdown.js
Normal file
25
static/js/fix-dropdown.js
Normal file
@ -0,0 +1,25 @@
|
||||
// Make sure the dropdown works correctly
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
const dropdownMenu = document.querySelector('.dropdown-menu');
|
||||
|
||||
if (exportBtn && dropdownMenu) {
|
||||
// Force clear any previous event listeners
|
||||
const newExportBtn = exportBtn.cloneNode(true);
|
||||
exportBtn.parentNode.replaceChild(newExportBtn, exportBtn);
|
||||
|
||||
// Add event listener to the new button
|
||||
newExportBtn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dropdownMenu.style.display = dropdownMenu.style.display === 'block' ? 'none' : 'block';
|
||||
});
|
||||
|
||||
// Close dropdown when clicking elsewhere
|
||||
document.addEventListener('click', function(e) {
|
||||
if (newExportBtn && \!newExportBtn.contains(e.target) && dropdownMenu && \!dropdownMenu.contains(e.target)) {
|
||||
dropdownMenu.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user