<!-- Slider Dot Colors-->
<style>
.w-slider-dot {
background: teal;
}
.w-slider-dot.w-active {
background: #133a27;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Find all sliders with the cms-slider attribute
const sliders = document.querySelectorAll('[cms-slider]');
// Loop through each slider
sliders.forEach((slider) => {
// Get the value of the cms-slider attribute for this slider
const sliderAttrValue = slider.getAttribute('cms-slider');
// Find the corresponding list based on the attribute value
const listElement = document.querySelector(`[cms-slider-list="${sliderAttrValue}"]`);
// Find the mask within this slider
const sliderMask = slider.querySelector('.w-slider-mask');
// If both elements are found
if (sliderMask && listElement) {
// Get the first slide as a template
const firstSlide = sliderMask.querySelector('.w-slide');
// Loop through each child of the list
listElement.childNodes.forEach((item) => {
if (item.nodeType === Node.ELEMENT_NODE) {
// Clone the first slide
const newSlide = firstSlide.cloneNode(true);
// Remove existing children from the cloned slide
while (newSlide.firstChild) {
newSlide.removeChild(newSlide.firstChild);
}
// Add the content from the list item into the new slide
const clonedItem = item.cloneNode(true);
newSlide.appendChild(clonedItem);
// Append the new slide to the slider mask
sliderMask.appendChild(newSlide);
}
});
// Remove the initial template slide
firstSlide.remove();
// Redraw the slider to reflect the changes
Webflow.require('slider').redraw();
}
});
});
</script>