SwiperJS๐Ÿ’ก

์ง€๋…ํ•˜๊ฒŒ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, ํ”„๋ ˆ์ž„์›Œํฌ์˜ ์‚ฌ์šฉ์„ ํ”ผํ•ด์˜ค๋ฉฐ ์ˆ˜์ž‘์—…์œผ๋กœ ๋กœ์ง์„ ์งœ๋˜ ๋‚ด๊ฐ€
์ด์ œ ํ˜‘์—…, ๊ณผ์ œ ๋“ฑ์œผ๋กœ ๋“œ๋””์–ด ์ด๋Ÿฐ์ €๋Ÿฐ ์„ธ์ƒ์˜ ์ด๋กœ์šด ๊ธฐ๋Šฅ๋“ค์„ ๊ฐ€์ ธ๋‹ค ์“ฐ๊ธฐ ์‹œ์ž‘ํ–ˆ๋‹ค...

๊ทธ ์ค‘ swiper์˜ ์ ์šฉ์„ ํ•ด๋ณด๋Š” ์ค‘์— ์ƒ๊ธด ์ด์Šˆ์— ๋Œ€ํ•œ ํ•ด๊ฒฐ๋ฒ•์„ ํ’€์–ด๋ณธ๋‹ค
๊ฒฐ๋ก ๋ถ€ํ„ฐ ๋งํ•˜์ž๋ฉด... ๋น ๋ฅด๊ฒŒ ๋ฒ„์ „์—…๋ฐ์ดํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š” swiper์˜ ์ตœ์‹  ๋ฌธ๋ฒ•์„ ์ ์šฉํ•˜์ง€ ๋ชปํ•œ ์ด์œ ์˜€์—ˆ๋‹ค!

๐ŸงกIssue

  import Swiper from 'swiper';
  import 'swiper/swiper-bundle.min.css';
  import 'swiper/swiper.min.css';
  import 'swiper/modules/navigation/navigation-element.min.css';
  import 'swiper/modules/pagination/pagination-element.min.css';

  new Swiper(newItemSliderEl, {
    autoplay: {
      delay: 3500,
      disableOnInteraction: false,
    },
    slidesPerView : 4,
    spaceBetween: 35,
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    pagination: {
      el : '.swiper-pagination',
    },
  });

์œ„์™€๊ฐ™์ด ์Šค์™€์ดํผ๋ฅผ ์ ์šฉํ•œ ์Šฌ๋ผ์ด๋”๋ฅผ ๋งŒ๋“ค์—ˆ์—ˆ๋Š”๋ฐ, ์–‘ ์˜†์˜ ํŽ˜์ด์ง€ ๋„˜๊ธฐ๊ธฐ ๋ฒ„ํŠผ (ํ™”์‚ดํ‘œ)๋ฅผ ์•„๋ฌด๋ฆฌ ๋ˆŒ๋Ÿฌ๋„ ์Šฌ๋ผ์ด๋”๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š์•˜๋‹ค.

๋งˆ์šฐ์Šค ๋“œ๋ž˜๊ทธ๋กœ๋Š” ์Šฌ๋ผ์ด๋”ฉ์ด ๊ฐ€๋Šฅํ–ˆ์ง€๋งŒ Navigation, Pagination, Autoplay ๋“ฑ ๋งˆ์šฐ์Šค ๋“œ๋ž˜๊ทธ๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ์Šฌ๋ผ์ด๋”ฉ์ด ๋™์ž‘ํ•˜์ง€ ์•Š์•˜๊ณ , ํ•œ์ฐธ์„ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋„ ๋‚ด ์ฝ”๋“œ๊ฐ€ ๋ญ๊ฐ€ ์ž˜๋ชป๋๋Š”๋ฐ?? ํ™˜๊ฒฝ์„ค์ •๋ฌธ์ œ์ธ๊ฐ€?? ํ•˜๋ฉฐ ๋‹ต๋‹ตํ–ˆ์—ˆ๋‹ค ๐Ÿคฏ

๐Ÿงกํ•ด๊ฒฐ

๋ฌธ์ œ๋Š” ๋ฒ„์ „์ด์˜€๋‹ค! swiper๋Š” ์•„์ฃผ ๋น ๋ฅด๊ฒŒ ๋งŽ์€ ๋ฒ„์ „์„ ๋‚ด์–ด๋†“๊ณ  ์žˆ๋Š”๋ฐ, ๊ตฌ๊ธ€๋ง์—์„œ ๋‚˜์˜จ ๋ฌธ๋ฒ•๋“ค์€ ๊ฑฐ์˜ ๊ตฌ๋ฒ„์ „์˜ ๋ฌธ๋ฒ•์ด์˜€๋˜ ๊ฒƒ...

์ตœ์‹  ๋ฌธ๋ฒ•์—์„œ ์ง€์ •๋œ ๋ช‡ ์˜ต์…˜๋“ค์€ ํ•ด๋‹น ๋ชจ๋“ˆ์„ importํ•ด์™€์•ผ๋งŒ ์ž‘๋™์„ ํ•˜๋Š” ๊ฒƒ์ด์˜€๋‹ค!

  // swiper์™ธ์— ์‚ฌ์šฉํ•  ๊ธฐ๋Šฅ๋“ค์„ ํ•จ๊ป˜ ๋ถˆ๋Ÿฌ์˜จ๋‹ค
  import Swiper, {Navigation, Pagination, Autoplay} from 'swiper';
  import 'swiper/swiper-bundle.min.css';
  import 'swiper/swiper.min.css';
  import 'swiper/modules/navigation/navigation-element.min.css';
  import 'swiper/modules/pagination/pagination-element.min.css';

  new Swiper(newItemSliderEl, {
    //modules์— ์‚ฌ์šฉ ํ•  ์˜ต์…˜๋“ค์„ ์ง€์ •ํ•œ๋‹ค
    modules: [Navigation, Pagination, Autoplay],
    autoplay: {
      delay: 3500,
      disableOnInteraction: false,
    },
    slidesPerView : 4,
    spaceBetween: 35,
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    pagination: {
      el : '.swiper-pagination',
    },
  });

๋งˆ์น˜๋ฉฐ๐Ÿ™Œ

์•ž์œผ๋กœ ๊ตฌ๊ธ€๋ง์„ ํ•  ๋•Œ์—” ํฌ์ŠคํŒ… ๋œ ๋‚ ์งœ์™€ ํ•ด๋‹น ๊ธฐ๋Šฅ์˜ ๋ฒ„์ „์„ ๊ผญ..ํ•จ๊ป˜ ํ™•์ธํ•ด์•ผ๊ฒ ๋‹ค๐Ÿคง

profile
ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์ผ๊ธฐ ๐Ÿ’ญ

0๊ฐœ์˜ ๋Œ“๊ธ€