제이쿼리 질문

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
제이쿼리 질문

QA

제이쿼리 질문

본문

초보 퍼블리셔입니다.

스와이퍼 슬라이드를 구현하는데 해상도1024px이상 화면에서 슬라이드카드 5개를 보여주고

1024이하에서 3개를 보여주고 싶은데 resize했을때  slidesPerView: 5 이부분을 어떻게 바꿔야 하나요 ??

빨간부분 어떻게 입력해하는지 궁급합니다.

좀 허접한 질문이지만 ,, 고수님들 도움 부탁드립니다..!

 

$(document).ready(function() {

  // Assign some jquery elements we'll need

  var $swiper = $(".swiper-container");

  var $bottomSlide = null; // Slide whose content gets 'extracted' and placed

  // into a fixed position for animation purposes

  var $bottomSlideContent = null; // Slide content that gets passed between the

  // panning slide stack and the position 'behind'

  // the stack, needed for correct animation style

 

  var mySwiper = new Swiper(".swiper-container", {

    spaceBetween: 20,

    slidesPerView: 5,

    centeredSlides: true,

    roundLengths: true,

    loop: true,

    loopAdditionalSlides: 30,

    navigation: {

      nextEl: ".btn.slide_next",

      prevEl: ".btn.slide_prev"

    }

  });

  $(window).resize(function(){

 

    var width = window.innerWidth;

        if(width < 1024){

            여기에 어떻게 들어가야하나요?

                }

        else {여기에 어떻게 들어가야하나요?}

    }).resize();

});


 

이 질문에 댓글 쓰기 :

답변 1

스와이퍼 옵션 자체에 반응형 대응이 포함되어 있습니다.

https://github.com/nolimits4web/Swiper/blob/master/demos/380-responsive-breakpoints.html

 


var mySwiper = new Swiper(".swiper-container", {
    spaceBetween: 20,
    slidesPerView: 5,
    centeredSlides: true,
    roundLengths: true,
    loop: true,
    loopAdditionalSlides: 30,
    navigation: {
      nextEl: ".btn.slide_next",
      prevEl: ".btn.slide_prev"
    }
    breakpoints: {
        1024: {
          slidesPerView: 3,
          
        },
    }
  });

 

위 코드와 같이 제어하시면 됩니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 607
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT