Swiper js로 확대/축소 슬라이더
                                            
                                                
                                                
                                                
                                                
                                                
                                                 8002 단어  codenewbiecssjavascriptbeginners
                    

먼저 필요한 파일을 가져와야 합니다.
head에는 스타일을 포함하고 body 태그의 끝에는 script를 포함합니다.
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" /> 
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
필수 마크업을 추가합니다.
<div class="container"> <!-- container to center and set slider width -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <div class="swiper-zoom-container"> <!-- All "zoomable" images should be wrapped with the div with swiper-zoom-container class. -->
                    <img src="http://pngimg.com/uploads/bottle/bottle_PNG2095.png" />
                </div>
            </div>
            <div class="swiper-slide">
                <div class="swiper-zoom-container">
                    <img src="http://pngimg.com/uploads/bottle/bottle_PNG2093.png" />
                </div>
            </div>
            <div class="swiper-slide">
                <div class="swiper-zoom-container">
                    <img src="http://pngimg.com/uploads/bottle/bottle_PNG2081.png" />
                </div>
            </div>
        </div>
    </div>
</div>
스타일
body {
    margin: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.container {
    width: 600px;
    height: 600px;
}
.swiper-container,
.swiper-wrapper,
.swiper-slide {
    width: 100%;
    height: 100%;
}
.swiper-slide img {
    display: block;
    margin: 0 auto;
    width: auto;
    height: 80%;
}
이제 JavaScript를 추가할 차례입니다.
// Initialize new Swiper instance
const swiper = new Swiper(".swiper-container", {
        // Setting default settings
    grabCursor: true,
    centeredSlides: true,
    loop: true,
        // Setting minimum and maximum zoom ration
    zoom: {
        maxRatio: 1.2,
        minRation: 1
    },
});
// Use built in zoom.in() and zoom.out() function to scale images
// When slide starts to change slideChangeTransitionStart event fires and we use it to scale down the image. 
swiper.on("slideChangeTransitionStart", swiper.zoom.out);
// And when transition has finished scale it up.
swiper.on("slideChangeTransitionEnd", swiper.zoom.in);
그게 다야. 당신이 그것을 좋아 바랍니다 :)
Reference
이 문제에 관하여(Swiper js로 확대/축소 슬라이더), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/sasscrafter/zoom-in-out-slider-with-swiper-js-jj텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)