[JS + jquery] bxSlider ํ”Œ๋Ÿฌ๊ทธ์ธ ์ด์šฉํ•ด์„œ ๊ฐ„๋‹จํ•œ ๊ฐค๋Ÿฌ๋ฆฌ ๋งŒ๋“ค๊ธฐ

2021. 11. 3. 11:10ใ†HTML + CSS + JS/JS ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ

728x90

 < > ํ™”์‚ดํ‘œ๋ฅผ ํด๋ฆญํ•˜๋ฉด ์˜†์œผ๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๊ณ , ์ž๋™์œผ๋กœ ์‚ฌ์ง„์ด ์ „ํ™˜๋˜๊ณ ,

๋ฐ‘์˜ ์ด๋ฏธ์ง€๋ฅผ ํด๋ฆญํ•˜๋ฉด ๊ทธ ์ด๋ฏธ์ง€๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค. 

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title> Plugin </title>
<script src="js/jquery.js"></script>
<script src="js/jquery.bxslider.min.js"></script>
<link rel="stylesheet" href="css/jquery.bxslider.min.css">
<style>
	*{margin: 0;padding: 0;}
	li{list-style: none;}
	#gallery_wrap{ margin: 0 auto; width: 450px;}
	#gallery_wrap .bx-wrapper{margin-bottom: 20px;}
	.slider-pager{text-align: center;}
	.slider-pager li{display: inline;}
</style>
<script>
$(function() {
	$(".slide_gallery").bxSlider({
		auto : true, 
		autoControls : false, 
		pagerCustom : '.slider-pager'
	});
});
</script>
</head>
<body>
<div id="gallery_wrap">
	<ul class="slide_gallery">
		<li><img src="images/pic_1.jpg" alt="์‚ฌ์ง„1"></li>
		<li><img src="images/pic_2.jpg" alt="์‚ฌ์ง„2"></li>
		<li><img src="images/pic_3.jpg" alt="์‚ฌ์ง„3"></li>
		<li><img src="images/pic_4.jpg" alt="์‚ฌ์ง„4"></li>
		<li><img src="images/pic_5.jpg" alt="์‚ฌ์ง„8"></li>
	</ul>
	<ul class="slider-pager">
		<li><a href="#" data-slide-index="0">
			<img src="images/pic_t1.jpg" alt="์‚ฌ์ง„1"></a>
		</li>
		<li><a href="#" data-slide-index="1">
			<img src="images/pic_t2.jpg" alt="์‚ฌ์ง„2"></a>
		</li>
		<li><a href="#" data-slide-index="2">
			<img src="images/pic_t3.jpg" alt="์‚ฌ์ง„3"></a>
		</li>
		<li><a href="#" data-slide-index="3">
			<img src="images/pic_t4.jpg" alt="์‚ฌ์ง„4"></a>
		</li>
		<li><a href="#" data-slide-index="4">
			<img src="images/pic_t5.jpg" alt="์‚ฌ์ง„5"></a>
		</li>
	</ul>
</div>
</body>
</html>

1๏ธโƒฃ auto ๋Š” ์Šฌ๋ผ์ด๋“œ ์ž๋™ ์ „ํ™˜ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์œผ๋กœ true๋กœ ์„ค์ •ํ•˜๋ฉด ์ž๋™ ์ „ํ™˜ ๋œ๋‹ค. 

2๏ธโƒฃ autoControls ๋Š” ์ž๋™ ์ „ํ™˜ ์—ฌ๋ถ€์— ๋Œ€ํ•ด ๋ฉˆ์ถค๊ณผ ์žฌ์ƒ ๋ฒ„ํŠผ์„ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์œผ๋กœ false๋ฅผ ํ•˜๋ฉด ์ œ๊ณต๋˜์ง€ ์•Š๋Š”๋‹ค.

3๏ธโƒฃ pagerCustom ์€ ๋ฐ‘์˜ ์‚ฌ์ง„์„ ํด๋ฆญํ•˜๋ฉด ๊ทธ์— ๋Œ€ํ•œ ์ด๋ฏธ์ง€๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

728x90