패스트캠퍼스 온라인 강의를 통해 만든 ★다방 랜딩페이지. 이미지를 가로로 슬라이딩하는 방법과 슬라이딩 페이지 관련 요소를 삽입하는 방법을 배웠다
<div class="swiper-pagination"></div>
<div class="swiper-prev">
<div class="material-icons">arrow_back</div>
</div>
<div class="swiper-next">
<div class="material-icons">arrow_forward</div>
</div>
new Swiper('.promotion .swiper-container', {
slidesPerView: 3,
spaceBetween: 10,
centeredSlides: true,
loop: true,
autoplay: {
delay: 5000
},
pagination: {
el: '.swiper-pagination',
clickable: true
},
navigation: {
prevEl: '.swiper-prev',
nextEl: '.swiper-next'
}
.notice .promotion .swiper-pagination {
bottom: 40px;
left: 0;
right: 0;
}
.notice .promotion .swiper-pagination .swiper-pagination-bullet{
background-color: transparent;
background-image: url("../images/promotion_slide_pager_on.png");
width: 12px;
height: 12px;
margin-right: 6px;
outline: none;
}
.notice .promotion .swiper-pagination .swiper-pagination-bullet:last-child{
margin-right: 0px;
}
.notice .promotion .swiper-pagination .swiper-pagination-bullet-active{
background-image: url("../images/promotion_slide_pager_on.png");
}
/* 다중선택자 방식으로 작성 */
.notice .promotion .swiper-prev,
.notice .promotion .swiper-next{
width: 42px;
height: 42px;
border: 2px solid #333;
border-radius: 50%;
position: absolute;
top: 300px;
z-index: 1;
cursor: pointer;
outline: none;
/* 아이콘 가운데 정렬 */
display: flex;
justify-content: center;
align-items: center;
transition: .4s;
}
.notice .promotion .swiper-prev{
left: 50%;
margin-left: -480px;
}
.notice .promotion .swiper-next{
right: 50%;
margin-right: -480px;
}
.notice .promotion .swiper-prev:hover,
.notice .promotion .swiper-next:hover {
background-color: #333;
color: #fff;
}