sigit_design/assets/js/dashboardTriggers.js

27 lines
1015 B
JavaScript
Raw Permalink Normal View History

2024-07-25 16:16:25 +00:00
document.addEventListener("DOMContentLoaded", function() {
// Function to toggle display of elements based on trigger clicks
function toggleDisplay(triggerId, targetId) {
const trigger = document.getElementById(triggerId);
const target = document.getElementById(targetId);
if (trigger && target) {
trigger.addEventListener("click", function() {
if (target.style.display === "none" || target.style.display === "") {
target.style.display = "flex";
} else {
target.style.display = "none";
}
});
}
}
// Example usage for uploadTrigger
toggleDisplay("uploadTrigger", "uploadTriggered");
// Example usage for filtersTrigger
toggleDisplay("filtersTrigger", "filtersTriggered");
// You can add more similar elements by calling toggleDisplay function with appropriate IDs
// toggleDisplay("anotherTrigger", "anotherTriggered");
});