const BeerSlider = () => {
const settings = {
className: 'center',
dots: true,
infinite: true,
speed: 500,
focusOnSelect: true,
slidesToShow: 3,
centerMode: true,
slidesToScroll: 1,
centerPadding: '230px',
onInit: () => {
```add class prev and next slick slide ```
}
}
Asked
Active
Viewed 1,423 times
1

Richard Dallaway
- 4,250
- 1
- 28
- 39

verba
- 11
- 3
1 Answers
1
You can actually replace the next and previous arrow icons come default. I think that would be better than adding styles to existing CSS classes.
1st way
Add more CSS properties for the existing CSS class
.slick-arrow.slick-next {
// your styles
...
...
}
.slick-arrow.slick-prev {
// your styles
...
...
}
2nd way
Add custom next and previous buttons
const settings = {
className: "center",
dots: true,
infinite: true,
speed: 500,
focusOnSelect: true,
slidesToShow: 3,
centerMode: true,
slidesToScroll: 1,
centerPadding: "230px",
nextArrow: <RightNavButton />,
prevArrow: <LeftNavButton />
};
function LeftNavButton(props) {
const { className, style, onClick } = props;
return (
<div
className="slick-arrow"
style={{ ...style, display: "block" }}
onClick={onClick}
>
<div className="artilces-slider-left-arrow">
{/* this is font awesome icons */}
<i class="fas fa-angle-left"></i>
</div>
</div>
);
}
function RightNavButton(props) {
const { className, style, onClick } = props;
return (
<div
className="slick-arrow"
style={{ ...style, display: "block" }}
onClick={onClick}
>
<div className="artilces-slider-right-arrow">
{/* this is font awesome icons */}
<i class="fas fa-angle-right"></i>
</div>
</div>
);
}

Amila Senadheera
- 12,229
- 15
- 27
- 43
-
@verba, check this out!! – Amila Senadheera Jun 26 '21 at 05:00
-
I have a same question how to add class on previous slide and next slide. The solution provided by Amila is on the button Next and Prev. How about on slides. – Salman Aziz Oct 20 '21 at 05:21