I have an automatic carousel on my website. When I resize the browser, the functionality of the carousel still works but the images become distorted (the carousel shows some of both pictures)
Here is the codepen: https://codepen.io/Harrison17/pen/VweamoL
const slideWidth = slides[index].clientWidth;
slide.style.transform = `translateX(${-slideWidth * index}px)`;
I think I need to add an event listener for a resizing of the window but I'm not sure how to implement it into my code.