Swiper 스와이퍼 슬라이더 기본 코드
Swiper - The Most Modern Mobile Touch Slider
Swiper is the most modern free mobile touch slider with hardware accelerated transitions and amazing native behavior.
swiperjs.com
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<!-- Initialize Swiper -->
<script>
var swiper = new Swiper(".mySwiper", {
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
</script>
위와 같이 기본 CSS를 불러와 사용하면 아래처럼 모든 버튼들 컬러가 파란색으로 보여진다.
Navigation, Pagination 컬러 변경
네비게이션, 페이지네이션의 파란색을 다른 색으로 변경하는 방법은 아주 간단하다.
아래와 같이 테마 컬러를 변경해주는 코드를 추가해주면 된다. 단, 기존 Swiper CSS 코드보다 아래쪽에 위치해야한다.
<style>
:root {
--swiper-theme-color: #000
}
</style>
그러면 이렇게 화살표 네비게이션과 페이지네이션이 모두 검정 컬러로 변경된다. 간단하게 변경 끝!
- Swiper 관련 다른 글들 -
[jQuery] Swiper Options 자주 사용하는 옵션
여러모로 다양하게 활용이 가능한 jQuery 슬라이더 Swiper https://swiperjs.com/ Swiper - The Most Modern Mobile Touch Slider Swiper is the most modern free mobile touch slider with hardware accelerated transitions and amazing native behavior
hongpage.kr
Swiper 슬라이더 익스플로러에서 작동 안될 때 해결 방법
다양한 옵션과 효과를 제공하여 홈페이지에서 많이 사용하고 있는 Swiper 슬라이더. 작업을 다 하고 브라우저별로 확인하는데 익스플로러에서는 Swiper 작동이 안되는 불상사가. 여기저기 헤매던
hongpage.kr
[오류] Swiper 오류 해결 Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type '
잘 쓰고 있던 swiper 스크립트에서 어느날 갑자기 이런 오류가 떴다. Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. 구글링해봤더니 Window에 파라미터를 지정해
hongpage.kr
'개발 > js·jquery' 카테고리의 다른 글
[jQuery] input 엔터 시 특정 함수 실행 (0) | 2024.08.12 |
---|---|
자바스크립트 예약어 (2) | 2024.02.27 |
[jQuery] 새로고침 시 스크롤 위치 맨위로 리셋해주는 스크립트 (4) | 2023.11.19 |
[jQuery] 스크롤 이벤트 / 스크롤 특정 위치에 따라 효과 변경 (4) | 2023.11.19 |
[jQuery] 날짜선택 플러그인 DatePicker 옵션 (2) | 2023.09.12 |
[jQUery/JS] 음악 비디오 재생/일시정지/음소거 버튼 만들기 (2) | 2023.08.21 |
[jQuery] 결과값 숫자로 보여주기 (숫자에 콤마 찍기) (2) | 2023.06.05 |
jQuery 오류 - The page at '<URL>' was loaded over HTTPS, but requested an insecure script '<URL>' (2) | 2023.05.04 |