Last active
December 21, 2022 07:52
-
-
Save wplit/d40d920d5ddb1885a51bb1fa0bb9000b to your computer and use it in GitHub Desktop.
multiple buttons to open gallery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener("DOMContentLoaded", () => { | |
const buttons = document.querySelectorAll(".graphic_gallery"); | |
buttons.forEach((button) => { | |
const prevSibling = button.previousElementSibling; | |
const firstItem = prevSibling.querySelector(".bricks-lightbox"); | |
button.addEventListener("click", (event) => { | |
event.preventDefault(); | |
firstItem.click(); | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment