2018-01-04
자바스크립트에서 슬라이드효과를 주는건 참 많이 있다.
그중에 최근 괜찮은걸 하나 써보고 이렇게 포스팅을 한다.

링크: https://www.jssor.com/

아래는 사용 예제 이다.
<script type="text/javascript" src="/post_inc/jquerys/jssor.slider.min.js"></script>
<script>
$(function(){

	var jssor_1_SlideshowTransitions = [
		{$Duration:500,$Delay:30,$Cols:8,$Rows:4,$Clip:15,
			$SlideOut:true,$Formation:$JssorSlideshowFormations$.$FormationStraightStairs,
			$Assembly:2049,$Easing:$Jease$.$OutQuad},
		{$Duration:500,$Delay:80,$Cols:8,$Rows:4,$Clip:15,
			$SlideOut:true,$Easing:$Jease$.$OutQuad},
		{$Duration:1000,x:-0.2,$Delay:40,$Cols:12,$SlideOut:true,
			$Formation:$JssorSlideshowFormations$.$FormationStraight,
			$Assembly:260,$Easing:{$Left:$Jease$.$InOutExpo,$Opacity:$Jease$.$InOutQuad},
			$Opacity:2,$Outside:true,$Round:{$Top:0.5}},
		{$Duration:2000,y:-1,$Delay:60,$Cols:15,$SlideOut:true,
			$Formation:$JssorSlideshowFormations$.$FormationStraight,
			$Easing:$Jease$.$OutJump,$Round:{$Top:1.5}},
		{$Duration:1200,x:0.2,y:-0.1,$Delay:20,$Cols:8,$Rows:4,
			$Clip:15,$During:{$Left:[0.3,0.7],$Top:[0.3,0.7]},
			$Formation:$JssorSlideshowFormations$.$FormationStraightStairs,
			$Assembly:260,$Easing:{$Left:$Jease$.$InWave,$Top:$Jease$.$InWave,
			$Clip:$Jease$.$OutQuad},$Round:{$Left:1.3,$Top:2.5}}
	];

	var jssor_1_options = {
		$AutoPlay: 1,
		$SlideshowOptions: {
			$Class: $JssorSlideshowRunner$,
			$Transitions: jssor_1_SlideshowTransitions,
			$TransitionsOrder: 1
		},
		$ArrowNavigatorOptions: {
			$Class: $JssorArrowNavigator$
		},
		$BulletNavigatorOptions: {
			$Class: $JssorBulletNavigator$
		}
	};

	var jssor_1_slider = new $JssorSlider$("jssor_1", jssor_1_options);

	/*#region responsive code begin*/

	var MAX_WIDTH = 980;

	function ScaleSlider() {
			var containerElement = jssor_1_slider.$Elmt.parentNode;
			var containerWidth = containerElement.clientWidth;

			if (containerWidth) {

					var expectedWidth = Math.min(MAX_WIDTH || containerWidth, containerWidth);

					jssor_1_slider.$ScaleWidth(expectedWidth);
			}
			else {
					window.setTimeout(ScaleSlider, 30);
			}
	}

	ScaleSlider();
});
</script>
<style>
.jssorb053 .i {position:absolute;cursor:pointer;}
.jssorb053 .i .b {fill:#fff;fill-opacity:0.5;}
.jssorb053 .i:hover .b {fill-opacity:.7;}
.jssorb053 .iav .b {fill-opacity: 1;}
.jssorb053 .i.idn {opacity:.3;}
.jssora093 {display:block;position:absolute;cursor:pointer;}
.jssora093 .c {fill:none;stroke:#fff;stroke-width:400;stroke-miterlimit:10;}
.jssora093 .a {fill:none;stroke:#fff;stroke-width:400;stroke-miterlimit:10;}
.jssora093:hover {opacity:.8;}
.jssora093.jssora093dn {opacity:.6;}
.jssora093.jssora093ds {opacity:.3;pointer-events:none;}
</style>


<div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:980px;height:380px;overflow:hidden;visibility:hidden;">
		<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:980px;height:380px;overflow:hidden;">
				<div>
						<img data-u="image" src="/post_inc/html5_animate/test_img7.png" />
				</div>
				<div>
						<img data-u="image" src="/post_inc/html5_animate/test_img8.png" />
				</div>
				<div>
						<img data-u="image" src="/post_inc/html5_animate/test_img3.png" />
				</div>
				<div>
						<img data-u="image" src="/post_inc/html5_animate/test_img4.png" />
				</div>
				<div>
						<img data-u="image" src="/post_inc/html5_animate/test_img5.png" />
				</div>
				<div>
						<img data-u="image" src="/post_inc/html5_animate/test_img6.png" />
				</div>
				<div style="background-color:#ff7c28;">
						<div style="position:absolute;top:50px;left:50px;width:450px;height:62px;z-index:0;font-size:16px;color:#000000;line-height:24px;text-align:left;padding:5px;box-sizing:border-box;">							b1ix.net<br>
						jssor test
						</div>
				</div>
		</div>
		<!-- Bullet Navigator -->
		<div data-u="navigator" class="jssorb053" style="position:absolute;bottom:12px;right:12px;" data-autocenter="1" data-scale="0.5" data-scale-bottom="0.75">
				<div data-u="prototype" class="i" style="width:16px;height:16px;">
						<svg viewBox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
								<path class="b" d="M11400,13800H4600c-1320,0-2400-1080-2400-2400V4600c0-1320,1080-2400,2400-2400h6800 c1320,0,2400,1080,2400,2400v6800C13800,12720,12720,13800,11400,13800z"></path>
						</svg>
				</div>
		</div>
		<!-- Arrow Navigator -->
		<div data-u="arrowleft" class="jssora093" style="width:50px;height:50px;top:0px;left:30px;" data-autocenter="2" data-scale="0.75" data-scale-left="0.75">
				<svg viewBox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
						<circle class="c" cx="8000" cy="8000" r="5920"></circle>
						<polyline class="a" points="7777.8,6080 5857.8,8000 7777.8,9920 "></polyline>
						<line class="a" x1="10142.2" y1="8000" x2="5857.8" y2="8000"></line>
				</svg>
		</div>
		<div data-u="arrowright" class="jssora093" style="width:50px;height:50px;top:0px;right:30px;" data-autocenter="2" data-scale="0.75" data-scale-right="0.75">
				<svg viewBox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
						<circle class="c" cx="8000" cy="8000" r="5920"></circle>
						<polyline class="a" points="8222.2,6080 10142.2,8000 8222.2,9920 "></polyline>
						<line class="a" x1="5857.8" y1="8000" x2="10142.2" y2="8000"></line>
				</svg>
		</div>
</div>