Swiper-slider 페이지 넘김시 자동 높이 조절 및 Scroll top > 테크게시판

본문 바로가기
사이드메뉴 열기

테크게시판 HOME



Swiper-slider 페이지 넘김시 자동 높이 조절 및 Scroll top

페이지 정보

작성자 인바이트미 댓글 0건 조회 4,513회 작성일 21-08-19 08:52

본문

 Swiper-slider 페이지 넘김시 자동 높이 조절 및 Scroll top



 <script>

    var swiper = new Swiper('.swiper-container', {

  mode:'vertical',

  autoHeight: true,

      navigation: {

        nextEl: '.swiper-button-next',

        prevEl: '.swiper-button-prev',

      }

    });

  </script>

  <script>

function activeHeightSet() {


var activeHt = $(".swiper-slide-active .mainImg").height();

eventActiveHt(activeHt);

scrollUp();

}

function eventActiveHt(activeHt) {

$(".swiper-container").stop(true).animate(

{

},

100

);

}

function scrollUp() {

$("body, html").stop(true).animate(

{

scrollTop: "0",

},

1000

);

}

swiper.on("slideChangeTransitionStart", activeHeightSet);

  </script>



2023년 4월 01일 추가 ------------------------------------------------------------------------


<script>
var swiper = new Swiper('.swiper-container', {
mode: 'horizontal',
autoHeight: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
on: {

slideChange: function () {

// Slide change function

window.scrollTo(0, 0); // Scroll to the top of the page

}

}

});
</script>


댓글목록

등록된 댓글이 없습니다.

Total 24 / 1 page

테크게시판 목록

게시물 검색