위토즈 - 개발자프로그램판매공간

정보공유

[JQUERY] 탭으로 나눠지는 슬라이드 쇼


<link rel="stylesheet" href="<?php echo G5_CSS_URL;?>/swiper-bundle.min.css?ver=221113" />

<script src="<?php echo G5_JS_URL;?>/swiper.js?ver=221113"></script>

<style>

.tab_wrap {max-width: 800px;margin: 0 auto 0;padding: 0;}

.tab_wrap .tit_list {position: relative;font-size: 0;}

.tab_wrap .tit_list:before {content:'';position: absolute;bottom: 0;left: 0;width: 100%;height: 1px;background: #ddd;z-index: 1;}

.tab_wrap .tit_list > li {display: inline-block;vertical-align: top;margin-right: 3px;}

.tab_wrap .tit_list > li a {display: inline-block;padding: 10px 15px;border: 1px solid #fff;border-radius:4px 4px 0 0;font-size: 14px;color: #000;text-decoration: none;}

.tab_wrap .tit_list > li a:hover {background: #efefef;border-color: #efefef;}

.tab_wrap .tit_list > li.active a {position: relative;border-color: #ddd;border-bottom: 1px solid #fff;background: #fff;color: #337ab7;z-index: 2;}

.tab_wrap .tab_con {border: 1px solid #ddd;border-top: none;background-color:#000}

.tab_wrap .tab_con .mySwiper {display: none;padding:0px;}

.tab_wrap .tab_con .mySwiper:first-child {display:block;}

.tab_wrap .swiper-pagination {position:relative;bottom:0;padding:8px 0;}

.tab_wrap .swiper-slide {text-align:center}

</style>


<div class="tab_wrap">

    <!-- 탭메뉴 제목 -->

    <ul class="tit_list">

        <!-- 디폴트 선택 li에 active 클래스 추가 -->

        <li class="active"><a href="#mySwiper0">1번째 탭</a></li>

        <li><a href="#mySwiper1">2번째 탭</a></li>

        <li><a href="#mySwiper2">3번째 탭</a></li>

    </ul>


    <!-- 탭메뉴 컨텐츠 -->

    <div class="tab_con">


        <!-- Swiper -->

        <div id="mySwiper0" class="swiper mySwiper">

            <div class="swiper-wrapper">

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/01_01.jpg"></div>

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/01_02.jpg"></div>

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/01_03.jpg"></div>

            </div>

            <div class="swiper-button-next"></div>

            <div class="swiper-button-prev"></div>

            <div class="swiper-pagination"></div>

        </div>


        <!-- Swiper -->

        <div id="mySwiper1" class="swiper mySwiper">

            <div class="swiper-wrapper">

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/02_01.jpg"></div>

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/02_02.jpg"></div>

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/02_03.jpg"></div>

            </div>

            <div class="swiper-button-next"></div>

            <div class="swiper-button-prev"></div>

            <div class="swiper-pagination"></div>

        </div>


        <!-- Swiper -->

        <div id="mySwiper2" class="swiper mySwiper">

            <div class="swiper-wrapper">

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/01_07.jpg"></div>

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/01_08.jpg"></div>

                <div class="swiper-slide"><img src="<?php echo G5_IMG_URL;?>/card_news/01_09.jpg"></div>

            </div>

            <div class="swiper-button-next"></div>

            <div class="swiper-button-prev"></div>

            <div class="swiper-pagination"></div>

        </div>

    </div>

</div>



<script type="text/javascript">

<!--

    var swiperArr = new Array();

    $('.mySwiper').each(function(index){

        swiperArr[index] = new Swiper('#mySwiper'+index, {

            spaceBetween: 0,

            centeredSlides: true,

            autoplay:false,

            pagination: {

                el: $('#mySwiper'+ index).find('.swiper-pagination'),

                clickable: true,

                type : 'fraction',   //페이징 타입 설정(종류: bullets, fraction, progressbar)

            },

            navigation: {

              nextEl: $('#mySwiper'+ index).find('.swiper-button-next'),

              prevEl: $('#mySwiper'+ index).find('.swiper-button-prev'),

            },

        });

    });


    $(document).ready(function () {

        $(document).on('click', '.tab_wrap .tit_list > li a', function(e) {


            e.preventDefault();


            //초기화

            $('.tab_wrap .tit_list > li').removeClass('active');

            $('.tab_wrap .mySwiper').hide();


            //실행

            $(this).parent().addClass('active');

            var activeTab = $(this).attr('href');

            var idx = $(this).parent().index();


            $(activeTab).show();

            swiperArr[idx].update();

        });

    });

//-->

</script>


첨부파일

정보공유
Total 453건 1 페이지
번호 제목 글쓴이 날짜 조회
453 자바스크립트를 이용해서 버튼 클릭시 이미지로 저장하는 방법 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-30 321
452 내부망의 자료를 외부에 연결해서 사용하게 하고 싶을때 사용하는 ngrok 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-27 374
451 html 폴더 생성하고 html 하위 파일은 확장자 없이도 연결가능하도록 .htaccess 파일 설정하기 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-21 486
450 on off 가능한 checkbox css + jquery 조합 버튼 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-17 520
449 비동기식으로 초성 버튼 클릭 보여주기 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-13 602
448 그누보드 관리자화면에 iframe 으로 띄울경우 엣지브라우저에서 튕기는 현상 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 03-17 1702
447 쿼리 성능 최적화 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 03-07 1596
446 스마트 에디터 세로 사이즈 강제로 해당 페이지에서만 늘리는 방법 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 02-28 1740
445 그누보드에 reCAPTCHA 설정하기 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 01-07 1796
444 mb_id 가 포함된 테이블 목록 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 11-22 2297
443 숫자형 input 요소 글자수 제한 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 08-29 3032
442 php 8.0 이상 버전에서 엑셀파일 업로드 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 07-18 4508
441 금액 카운팅 모션 다라라락 변화 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 06-26 3632
440 가장 심플한 예약 주문번호 생성 코드 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-28 4505
439 php 와 ajax 를 이용해서 파일 업로드 할때 대용량 파일을 업로드 하는 방법 위토즈쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 05-23 4968