Closed proccedure-caze closed 7 months ago
I changed it to an image and it works normally, I tried removing everything and leaving just the button class to see if it was that but it still lags. I also tried using another tag other than button.
<div ref={sliderRef} className="keen-slider flex items-center">
{categories.map((category) => {
return (
// <button
// key={category.id}
// data-active={selectedCategories.includes(
// category.name.toLowerCase(),
// )}
// style={{ minWidth: "fit-content" }}
// onClick={() => handleToggleCategory(category.name.toLowerCase())}
// className="keen-slider__slide rounded-full px-4 py-1 transition-all border border-purple100 text-purple100 data-[active='true']:border-purple200 data-[active='true']:bg-purple200 data-[active='true']:text-gray100"
// >
// {category.name}
// </button>
<Image
key={category.id}
alt=""
src="/assets/logo.svg"
width={0}
height={0}
className="w-auto h-auto keen-slider__slide"
/>
);
})}
Found out it was the transition-all
property, changing it to transition-colors
solved the laggyness issue.
Hello! I have already implemented before carousels using keen-slider but this time it has a strange behavior and I don't know what's the cause.
Here is the implementation (It is a client component that receives the array of data as props)
And these are my dependencies:
Deps:
Here is a video of the slider:
https://github.com/rcbyr/keen-slider/assets/114543712/5b79a4f0-0828-4ddb-9716-b5b51df16c1e