27 lines
1015 B
JavaScript
27 lines
1015 B
JavaScript
|
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");
|
||
|
});
|