🐨CoalaCoding
DocsExamplesTry itBoardB반
🐨CoalaCoding

개발자를 위한 한국어 웹 기술 문서

문서

  • JavaScript
  • Web Publishing
  • React
  • Python

커뮤니티

  • 게시판
  • 예제 모음
  • Try it 에디터

기타

  • GitHub
  • 관리자
© 2026 CoalaCoding. All rights reserved.
  • 01_topBtn
  • 02_rollingBanner
  • 03_menu
  • 04_stickyMenu
  • 05_accordion
  • 06_swiper
  • 07_activeMenu
  • 스킬바 UI
  • 09_slide
  • 10_tab
  • 11_scrollEffect
  • 12_ajax
  • 13_tabSlide
  • 14_gsap
  • 15_adaption
  • 16_좋은-디자인을-위한-요소
  • 17_논리적vs물리적해상도
  • 18_게슈탈트이론
  • 19_색채심리학
  • 20_황금비율
  • 21_컬러모드
  • 22_디자인실무용어
  • 23_이미지파일의특징
  • 24_폰트와사이즈
  • 25_레이아웃기초
  • 26_10가지법칙
  • 27_아이트래킹
  • 28_색상을성공적으로고르는방법
  • 29_타이포그래피10가지팁
  • 30_스타일가이드만들기
  • 31_모바일디자인버튼
  • 32_조형요소
  • 33_6가지비주얼체계규칙
  • 34_아이콘디자인이론
  • 35_해상도와그리드시스템
  • 36_피그마란
  • 37_작업환경세팅
  • 38_인터페이스예제
  • 39_기능심화
  • 40_인터페이스설계
  1. 홈
  2. 문서
  3. HTML & CSS
  4. UI 컴포넌트
  5. 09_slide

09_slide

코드 블록의 Try it Yourself 버튼으로 직접 실행할 수 있다.

구문

  • 1. 기본 슬라이드
    • 1.1. fadeInOut
      • 1.1.1. 메서드 활용
      • 1.1.2. 클래스 활용
    • 1.2. 이동
  • 2. 인디케이터가 있는 슬라이드

1. 기본 슬라이드

1.1. fadeInOut

1.1.1. 메서드 활용

미리보기

리소스 이미지

http://qwerew.cafe24.com/images/1.jpg
http://qwerew.cafe24.com/images/2.jpg
http://qwerew.cafe24.com/images/3.jpg
http://qwerew.cafe24.com/images/4.jpg
http://qwerew.cafe24.com/images/5.jpg
http://qwerew.cafe24.com/images/6.jpg
http://qwerew.cafe24.com/images/7.jpg
http://qwerew.cafe24.com/images/8.jpg
http://qwerew.cafe24.com/images/9.jpg
http://qwerew.cafe24.com/images/10.jpg

1.1.2. 클래스 활용

미리보기

<body>
  <div id="content">
    <h3>Simple Crossfade Waterfalls Slideshow</h3>
    <ul id="crossfade">
      <li>
        <a href="#"><img src="http://qwerew.cafe24.com/images/1.jpg" alt="" /></a>
        <p>1번</p>
      </li>
      <li>
        <a href="#"><img src="http://qwerew.cafe24.com/images/2.jpg" alt="" /></a>
        <p>2번</p>
      </li>
      <li>
        <a href="#"><img src="http://qwerew.cafe24.com/images/3.jpg" alt="" /></a>
        <p>3번</p>
      </li>
    </ul>
  </div>
</body>

1.2. 이동

jQuery1 미리보기

jQuery2 미리보기

HTML
<div id="content">
	<h3>Slideshow</h3>
	<ul id="crossfade">
		<li>
			<a href="#"><img src="http://qwerew.cafe24.com/images/1.jpg" alt="" /></a>
			<p>1번</p>
		</li>
		<li>
			<a href="#"><img src="http://qwerew.cafe24.com/images/2.jpg" alt="" /></a>
			<p>2번</p>
		</li>
		<li>
			<a href="#"><img src="http://qwerew.cafe24.com/images/3.jpg" alt="" /></a>
			<p>3번</p>
		</li>
	</ul>
</div>
CSS
#crossfade {
	position: relative;
	margin: auto;
	padding: 0;
	list-style-type: none;
	width: 600px;
	height: 400px;
	overflow: hidden;
}

#crossfade li {
	position: absolute;
	width: 600px;
	height: 400px;
}

#crossfade p {
	position: absolute;
	bottom: 0;
	padding: 20px;
	color: #fff;
	background: #000;
	background-color: rgba(0, 0, 0, 0.6);
	margin: 0;
	left: 0;
	right: 0;
}
JQurey1
const slide = $('#crossfade li');

// 정렬
slide.each((i, o) => {
	$(o).css('left', i * 100 + '%');
});

let idx = 0;

// 무한루프를 위한 setInterval
setInterval(() => {
	slide
		.eq(idx)
		.stop()
		.animate({ left: -100 + '%' }, 1000, function () {
			$(this).css('left', (slide.length - 1) * 100 + '%');
		});
	idx++;
	if (idx > slide.length - 1) {
		idx = 0;
	}
	slide
		.eq(idx)
		.stop()
		.animate({ left: 0 + '%' }, 1000);
}, 3000); // 3초마다 반복
JQurey2
		const slide = $('#crossfade li');
		let current = 0;
		// 정렬
		slide.each((i, o) => {
			$(o).css('left', i * 100 + '%');
		});

		setInterval(function () {
			var prev = slide.eq(current);
			move(prev, 0, '-100%');
			current++;
			if (current == slide.length) {
				current = 0;
			}
			var next = slide.eq(current);
			move(next, '100%', '0%');
		}, 3000);

		function move(tg, start, end) {
			tg.css('left', start).stop().animate({ left: end }, 1000);
		}

제이쿼리슬라이드 자바스크립트슬라이드

완성화면

목차

  • 구문