Skip to content

Instantly share code, notes, and snippets.

@unwiredtech
Last active February 12, 2025 15:21
Show Gist options
  • Select an option

  • Save unwiredtech/9b75d00325ddfd5bff73b43b9ab518f5 to your computer and use it in GitHub Desktop.

Select an option

Save unwiredtech/9b75d00325ddfd5bff73b43b9ab518f5 to your computer and use it in GitHub Desktop.
Grid Listing - Pagination Reposition
<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