2022/04/02 React Slick 슬라이더
2022. 4. 2. 16:10ㆍProject : 근의 공식(Muscle Formula)
https://react-slick.neostack.com/docs/get-started
Neostack
The last react carousel you will ever need
react-slick.neostack.com
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";
import할 때 ~빼면 작동한다.
내가 쓴 세팅 예제는 다음과 같고 세팅 파일을 export, import하는 식으로 컴포넌트에 적용했다.
export const settings = {
infinite: false,
arrows: true,
speed: 500,
slidesToShow: 4,
slidesToScroll: 4,
initialSlide: 0,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
}
},
{
breakpoint: 820,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
}
},
{
breakpoint: 540,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
}
}
]
};
화살표 색깔이 default가 투명인지 흰색인지, 흰 배경에 쓰면 화살표가 보이지 않는다.
이럴 때는 상위 css에서 다음과 같이 설정해준다. 지금 프로젝트의 경우 그냥 App.css에서 다음과 같이 설정해주었다.
.slick-prev:before,
.slick-next:before {
color: black !important;
}

참고자료
https://stackoverflow.com/questions/28998536/slick-slider-next-arrows-not-showing
Slick Slider Next Arrows not showing
I'm trying to get the next and previous arrows to show up next to the product slider, just like in the Slick Slider example. But my sample doesn't seem to load the appropriate fonts to make that h...
stackoverflow.com
'Project : 근의 공식(Muscle Formula)' 카테고리의 다른 글
| 2022/04/04 새로고침 후 페이지 이동 (1) | 2022.04.04 |
|---|---|
| 2022/04/03 수정된 API 문서 (0) | 2022.04.03 |
| 2022/03/27 리액트 TS에서 Div 태그로 에디터 만들기 (0) | 2022.03.27 |
| 2022/03/26 하위 컴포넌트에 id 부여하기 (1) | 2022.03.26 |
| 2022/03/26 리액트 onClick 이벤트 핸들러에 함수를 작동시킬 때 유의점 (1) | 2022.03.26 |