1.2.5 β€’ Published 1 year ago

simple-image-carousel v1.2.5

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

simple-image-carousel Demo WebSite

image-slider

Install

npm i simple-image-carousel

Languages

πŸ‡°πŸ‡· Korea

πŸ‡ΊπŸ‡Έ English

Korea

이미지 μŠ¬λΌμ΄λ”λŠ” 기본적으둜 lazy loading을 μ§€μ›ν•˜μ—¬, 슀크둀 μ‹œμ μ— 이미지λ₯Ό λ‘œλ“œν•©λ‹ˆλ‹€. | Props | μ„€λͺ… | κΈ°λ³Έκ°’ | νƒ€μž… | |---------------------|----------------------------------------------------------------------------|--------------------|---------------------| | images | { url: string } ν˜•μ‹μ˜ 객체 λ°°μ—΄λ‘œ, μŠ¬λΌμ΄λ”μ— ν‘œμ‹œν•  이미지 URL을 ν¬ν•¨ν•©λ‹ˆλ‹€. | - | { url: string }[] | | showArrows | μŠ¬λΌμ΄λ” μ–‘ μ˜†μ— ν™”μ‚΄ν‘œλ₯Ό ν‘œμ‹œν• μ§€ μ—¬λΆ€λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | true | boolean | | showDots | μŠ¬λΌμ΄λ” ν•˜λ‹¨μ— 점을 ν‘œμ‹œν• μ§€ μ—¬λΆ€λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | true | boolean | | enableDrag | λ“œλž˜κ·Έ κΈ°λŠ₯을 ν™œμ„±ν™”ν• μ§€ μ—¬λΆ€λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | true | boolean | | enableLoop | μŠ¬λΌμ΄λ”μ˜ 루프 κΈ°λŠ₯을 ν™œμ„±ν™”ν• μ§€ μ—¬λΆ€λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. μžλ™ μŠ¬λΌμ΄λ“œκ°€ ν™œμ„±ν™” 돼있으면 ν•΄λ‹Ή 값은 trueκ°€ λ©λ‹ˆλ‹€. | true | boolean | | width | μŠ¬λΌμ΄λ”μ˜ λ„ˆλΉ„λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | null | number | null | | height | μŠ¬λΌμ΄λ”μ˜ 높이λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | null | number | null | | objectFit | 이미지λ₯Ό λ§žμΆ”λŠ” 방식을 μ„€μ •ν•©λ‹ˆλ‹€. | fill | "fill" | "contain" | "cover" | "none" | "scale-down" | | dotColor | 점의 색상을 μ„€μ •ν•©λ‹ˆλ‹€. | rgb(0, 114, 255) | string | | dotHoverColor | 점을 마우슀둜 가리킬 λ•Œμ˜ 색상을 μ„€μ •ν•©λ‹ˆλ‹€. | rgb(135, 135, 135) | string | | dotBorderColor | 점의 ν…Œλ‘λ¦¬ 색상을 μ„€μ •ν•©λ‹ˆλ‹€. | rgb(152, 152, 152) | string | | arrowColor | ν™”μ‚΄ν‘œμ˜ 색상을 μ„€μ •ν•©λ‹ˆλ‹€. | white | string | | arrowSize | ν™”μ‚΄ν‘œμ˜ 크기λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | 50 | number | | dotSize | 점의 크기λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. | 13 | number | | borderRadius | μŠ¬λΌμ΄λ”μ˜ λͺ¨μ„œλ¦¬ λ°˜κ²½μ„ μ„€μ •ν•©λ‹ˆλ‹€. | 0 | number | | autoSlider | μžλ™ μŠ¬λΌμ΄λ“œ μ‹œκ°„(λ°€λ¦¬μ΄ˆ)을 μ„€μ •ν•©λ‹ˆλ‹€. | 0 | number | | duration | μŠ¬λΌμ΄λ“œ μ• λ‹ˆλ©”μ΄μ…˜ 지속 μ‹œκ°„(λ°€λ¦¬μ΄ˆ)을 μ„€μ •ν•©λ‹ˆλ‹€. | 300 | number |

μ‚¬μš© 예제

import React from 'react';
import ImageSlider from 'simple-image-carousel';

const images = [
  { url: 'https://example.com/image1.jpg' },
  { url: 'https://example.com/image2.jpg' },
  { url: 'https://example.com/image3.jpg' },
];

const App = () => (
{/* 넓이λ₯Ό μ§€μ •ν•΄ μ£Όμ§€ μ•ŠμœΌλ©΄ 기본적으둜 λΆ€λͺ¨ 크기의 100%λ₯Ό μ°¨μ§€ν•©λ‹ˆλ‹€ */}
   <div>
    <ImageSlider images={images} />
  </div>

{/* μ•„λž˜μ™€ 같은 propsλ₯Ό μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€. */}
  <div>
    <ImageSlider
      images={images}
      showArrows={true}
      showDots={true}
      enableDrag={true}
      enableLoop={true}
      width={600}
      height={400}
      objectFit="cover"
      dotColor="blue"
      dotHoverColor="lightblue"
      dotBorderColor="darkblue"
      dotSize={20}
      arrowColor="black"
      arrowSize={40}
      borderRadius={10}
      autoSlider={3000}
      duration={500}
    />
  </div>
);

export default App;

NextJS와 ν•¨κ»˜ μ‚¬μš©

import dynamic from "next/dynamic";

const ImageSlider = dynamic(() => import("simple-image-carousel"), {
	ssr: false,
});

English

The image slider supports lazy loading by default, loading images as they come into view during scrolling. | Props | Description | Default | Type | |---------------------|----------------------------------------------------------------------------|--------------------|---------------------| | images | An array of objects { url: string } containing image URLs to be displayed in the slider. | - | { url: string }[] | | showArrows | Determines whether arrows are shown on the sides of the slider. | true | boolean | | showDots | Determines whether dots are shown at the bottom of the slider. | true | boolean | | enableDrag | Enables or disables the drag functionality. | true | boolean | | enableLoop | Enables or disables the loop functionality of the slider. If auto slider is enabled, this value will be set to true. | true | boolean | | width | Sets the width of the slider. | null | number | null | | height | Sets the height of the slider. | null | number | null | | objectFit | Sets the object fit mode for the images. | fill | "fill" | "contain" | "cover" | "none" | "scale-down" | | dotColor | Sets the color of the dots. | rgb(0, 114, 255) | string | | dotHoverColor | Sets the color of the dots when hovered over. | rgb(135, 135, 135) | string | | dotBorderColor | Sets the border color of the dots. | rgb(152, 152, 152) | string | | arrowColor | Sets the color of the arrows. | white | string | | arrowSize | Sets the size of the arrows. | 50 | number | | dotSize | Sets the size of the dots. | 13 | number | | borderRadius | Sets the border radius of the slider. | 0 | number | | autoSlider | Sets the automatic slider interval time in milliseconds. | 0 | number | | duration | Sets the duration of the slide animation in milliseconds. | 300 | number |

Example Usage

import React from 'react';
import ImageSlider from 'simple-image-carousel';

const images = [
  { url: 'https://example.com/image1.jpg' },
  { url: 'https://example.com/image2.jpg' },
  { url: 'https://example.com/image3.jpg' },
];

const App = () => (
{/* If you don't specify a width, it defaults to 100% of the parent's size */}
   <div>
    <ImageSlider images={images} />
  </div>

{/* You can use the following props */}
  <div>
    <ImageSlider
      images={images}
      showArrows={true}
      showDots={true}
      enableDrag={true}
      enableLoop={true}
      width={600}
      height={400}
      objectFit="cover"
      dotColor="blue"
      dotHoverColor="lightblue"
      dotBorderColor="darkblue"
      dotSize={20}
      arrowColor="black"
      arrowSize={40}
      borderRadius={10}
      autoSlider={3000}
      duration={500}
    />
  </div>
);

export default App;

with NextJS

import dynamic from "next/dynamic";

const ImageSlider = dynamic(() => import("simple-image-carousel"), {
	ssr: false,
});
1.2.0

1 year ago

1.1.1

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.1.3

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago