Last active
February 12, 2025 15:21
-
-
Save unwiredtech/9b75d00325ddfd5bff73b43b9ab518f5 to your computer and use it in GitHub Desktop.
Grid Listing - Pagination Reposition
This file contains hidden or 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", function () { | |
| function repositionSlickDots() { | |
| const grid = document.querySelector("#what-we-do"); | |
| const dots = document.querySelector(".jet-slick-dots"); | |
| const draggable = document.querySelector(".slick-list.draggable"); | |
| if (grid && dots && draggable) { | |
| // Detach .jet-slick-dots from its parent | |
| const parent = dots.parentNode; | |
| if (parent) { | |
| parent.removeChild(dots); | |
| } | |
| // Reattach .jet-slick-dots above .slick-list.draggable | |
| draggable.parentNode.insertBefore(dots, draggable); | |
| console.log(".jet-slick-dots successfully moved above .slick-list.draggable"); | |
| } | |
| } | |
| // Run on page load | |
| repositionSlickDots(); | |
| // MutationObserver to detect dynamic changes and re-run the function | |
| const observer = new MutationObserver(repositionSlickDots); | |
| const sliderContainer = document.querySelector("#what-we-do"); | |
| if (sliderContainer) { | |
| observer.observe(sliderContainer, { childList: true, subtree: true }); | |
| } | |
| // Also trigger on window resize | |
| window.addEventListener("resize", repositionSlickDots); | |
| });</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment