Web
Html 분류

slick slider 커스텀으로 꾸미기 + jquery 이벤트 감지 + 커스텀 슬라이드 번호

작성자 정보

  • webveloper 작성
  • 작성일

컨텐츠 정보

본문

1. import



<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js" />

 

2. css



.contents-group{max-width:1280px;width:100%;margin:0 auto;position:relative;z-index:99}

.gallery-etc{display:flex;align-items:center;justify-content:space-around;position:absolute;z-index:99;right:5%;top:26px}

.slick-arrow{background:none;padding:0;margin:0;font-size:0;line-height:0}

ul.slick-dots{list-style:none;padding:0;margin:0 15px}

ul.slick-dots li{display:none}

ul.slick-dots li.slick-active{display:block;color:#3960CE;font-size:22px;font-weight:700}

ul.slick-dots li.slick-active span.wh{color:#fff}

.gallery{max-width:1280px;width:96%;margin:-190px auto}

.gallery .item{display:flex !important;align-items:center;width:100%;background:#002DAC;padding:30px;box-sizing:border-box;border-radius:10px}

.gallery .item .contents{display:flex;flex-direction:column;font-size:24px;margin:30px 20px;color:#fff}

.gallery .item .contents span:nth-child(2){font-size:32px;font-weight:700}

.slick-slide img{display:block;width:230px;margin:0 35px}

 

3. html



<div class="contents-group">

  <div class="gallery-etc">

    <button class="visual-prev">

      <svg width="19px" height="21px" version="1.1" xmlns="http://www.w3.org/2000/svg"

      xmlns:xlink="http://www.w3.org/1999/xlink">

        <g transform="matrix(1,0,0,1,-22365.3,-3188.43)">

          <g transform="matrix(1,0,0,1,22358.5,3182.43)">

            <path d="M25.002,16C25.002,16.552 24.555,17 24.002,17L9.867,17L14.83,24.445C15.137,24.905 15.013,25.526 14.553,25.832C14.382,25.946 14.19,26 13.999,26C13.676,26 13.358,25.844 13.166,25.555L6.796,16L13.166,6.445C13.472,5.985 14.091,5.861 14.553,6.168C15.013,6.474 15.137,7.095 14.83,7.555L9.867,15L24.002,15C24.555,15 25.002,15.448 25.002,16Z"

            style="fill:white;fill-rule:nonzero;" />

          </g>

        </g>

      </svg>

    </button>

    <div class="slick-visual-paging">

    </div>

    <button class="visual-next">

      <svg width="19px" height="21px" version="1.1" xmlns="http://www.w3.org/2000/svg"

      xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/">

        <g transform="matrix(1,0,0,1,-22567.3,-3188.43)">

          <g transform="matrix(-1,0,0,1,22592.3,3182.43)">

            <path d="M25.002,16C25.002,16.552 24.555,17 24.002,17L9.867,17L14.83,24.445C15.137,24.905 15.013,25.526 14.553,25.832C14.382,25.946 14.19,26 13.999,26C13.676,26 13.358,25.844 13.166,25.555L6.796,16L13.166,6.445C13.472,5.985 14.091,5.861 14.553,6.168C15.013,6.474 15.137,7.095 14.83,7.555L9.867,15L24.002,15C24.555,15 25.002,15.448 25.002,16Z"

            style="fill:white;fill-rule:nonzero;" />

          </g>

        </g>

      </svg>

    </button>

  </div>

  <div class="gallery">

    <div class="item">

      <div class="contents">

        <span>

          1번 설명입니다다

        </span>

      </div>

    </div>

    <div class="item">

      <div class="contents">

        <span>

          2번 설명입니다다

        </span>

      </div>

    </div>

    <div class="item">

      <div class="contents">

        <span>

          3번 설명입니다다

        </span>

      </div>

    </div>

  </div>

</div>

 

4. js + jquery



  $('.gallery').slick({

    infinite: true,

    dots: true,

    prevArrow: '.visual-prev',

    nextArrow: '.visual-next',

    appendDots: '.slick-visual-paging',

    customPaging: function(slider, i) {

      return '<span class="wh">0' + (i + 1) + '</span><span> | </span><span>0' + slider.slideCount + '</span>';

    }

  });

  $('.gallery').on('beforeChange',

  function(event, slick, currentSlide, nextSlide) {

    var calc = ((nextSlide + 1) / slick.slideCount) * 100;

  });


관련자료

댓글 0
등록된 댓글이 없습니다.
전체 40 / 1 페이지
RSS
  • 웹개발에 자주 쓰는 자바스크립트 라이브러리들 - 슬라이드/갤러리 (Carousel)
    등록자 tjslli
    등록일 05.08 조회 1707

    Html 슬라이드/갤러리 (Carousel) 01. 가장 유명한 Slick - https://kenwheeler.github.io/slick/ 설치 &l…

  • [CSS]css 가상 선택자 정리 및 비교 (nth-child, nth-of-type)
    등록자 CSS러버
    등록일 05.08 조회 1620

    Html :nth-child(N)= 부모안에 모든 요소 중 N번째 요소 A:nth-of-type(N)= 부모안에 A라는 요소 중 N번째 요소 :first…

  • 스크롤 이벤트 감지 + jquery + css
    등록자 webveloper
    등록일 04.15 조회 1733

    Html 1. css .caritem{display:flex;align-items:end;flex-direction:column;background:#0…

  • slick slider 커스텀으로 꾸미기 + jquery 이벤트 감지 + 커스텀 슬라이드 번호
    등록자 webveloper
    등록일 04.15 조회 1771

    Html 1. import <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.n…

  • 호버(hover) 할 때 jquery 이벤트 감지 방법
    등록자 webveloper
    등록일 04.15 조회 1781

    Html 안녕하세요. html 코딩 시 hover 할때 감지하는 이벤트 스크립트입니다. <style> .con-group { display: …

  • 그누보드 썸네일 이미지 화질 개선 방법
    등록자 PixelProphet
    등록일 01.10 조회 2730

    Php 그누보드에서 이미지를 올릴때, 간혹 이미지 화질이 떨어져 보이는 현상이 있습니다.... 이럴 때 제가 찾아본 방법 중에 가장 쉽게 해결 할 수 …

  • React 유튜브 채널 추천
    등록자 코드워리어
    등록일 01.09 조회 2192

    React React는 웹 개발에서 매우 인기 있는 라이브러리로, 학습을 위해 다양한 자료들이 필요합니다. React를 학습하고 싶은 분들을 위한 유튜버 …

  • PHP 배열의 기초
    등록자 console
    등록일 01.05 조회 2521

    Php 배열(array)이란? PHP에서 배열(array)은 맵(map)으로 이루어진, 순서가 있는 집합을 의미합니다. 맵(map)은한 쌍의 키(key…

  • PHP 기타 제어문
    등록자 console
    등록일 01.05 조회 2553

    Php 루프의 제어 일반적으로 조건식의 검사를 통해 루프로 진입하면,다음 조건식을검사하기 전까지 루프 안에 있는 모든 명령문을 실행합니다. 사용자는 c…

  • PHP 반복문
    등록자 console
    등록일 01.05 조회 2525

    Php 반복문 반복문이란 프로그램 내에서 같은 명령을 일정 횟수만큼 반복하여수행하는명령문입니다. 프로그램이 처리하는 대부분의코드는 반복적인 형태가 많으…

  • PHP 조건문
    등록자 console
    등록일 01.05 조회 2377

    Php PHP 표현식 표현식(expressions)은 PHP에서 가장 중요한 구성요소입니다. 표현식이란 모든 것이 값을 갖는다는 의미이며, PHP에서 …

  • PHP 기타 연산자
    등록자 console
    등록일 01.05 조회 2343

    Php 삼항 연산자(ternaryoperator) 삼항 연산자는 유일하게 피연산자를 세 개나 가지는 조건 연산자입니다. 삼항 연산자의 문법은 다음과 같…

  • PHP 비트 연산자
    등록자 console
    등록일 01.05 조회 2552

    Php 비트 연산자(bitwise operator) 비트 연산자는 논리 연산자와 비슷하지만, 비트(bit) 단위로 논리 연산을 수행합니다. 또한, 비트…

  • PHP 논리 연산자
    등록자 console
    등록일 01.05 조회 2609

    Php 논리 연산자(logical operator) 논리 연산자는 논리식을 판단하여, 참(true)과 거짓(false)을 반환합니다. and, or, …

  • PHP 비교 연산자
    등록자 console
    등록일 01.05 조회 2625

    Php 비교 연산자(comparisonoperator) 비교 연산자는피연산자사이의 상대적인 크기를 판단하여,참(true)과 거짓(false)을 반환합니…