Wow js는 애니메이션을 지연시켜 스크롤을 하면 시작하는 scroll reveal animation이다.

 

https://wowjs.uk/docs.html

 

wow.js — Documentation

Setup wow.js 1 Link to the CSS animation library Link to Animate.css (You can link to another CSS animation library by changing wow.js settings) 2 Link and activate wow.js new WOW().init(); Reveal CSS Animations 1 Make an element revealable Add the CSS cla

wowjs.uk

 

 

 

1. wowjs > GITHUB 들어가서 폴더 다운로드

2. wow.min.js 링크, 기본세팅

<head>
	<!-- Wow.js -->
	<script src="plugin/wowjs/wow.min.js"></script>
</head>
<body>
	<script>
		new WOW().init();
	</script>
</body>

 

3. 애니메이션 키프레임 만들고 키프레임이 적용될 클래스를 만든다.

딜레이시키고 싶은 요소에 클래스명 wow 넣기 

 

*option : data-wow-duration="2s" data-wow-delay="5s" 

 

left to right 

right to left 두개의 애니메이션 키프레임을 만들기

		<h1>scroll reveal animation</h1>
		<div class="parent">
			<img src="http://placehold.it/800x1500">
			<div class="ltor wow">left</div>
			<div class="rtol wow">right</div>
		</div>
/* css */
.parent {
	border: 1px solid #000;
	width: 800px;
	padding: 20px;
	margin-bottom: 30%;
	overflow: hidden;
}
.parent div {
	float: left;
	border: 3px solid #000;
	width: 50%;
	height: 200px;
	box-sizing: border-box;
	text-align: center;
	line-height: 200px;
	font-size: 3em;
}
.ltor {
	animation: ltor 1s linear;
	animation-fill-mode: both;
}
.rtol {
	animation: rtol 1s linear;
	animation-fill-mode: both;
}
@keyframes ltor {
	0% {
		opacity: 0;
		transform: translateX(-100px);
	}
	100% {
		opacity: 1;
		transform: translateX(0);
	}
}
@keyframes rtol {
	0% {
		opacity: 0;
		transform: translateX(150px);
	}
	100% {
		opacity: 1;
		transform: translateX(0);
	}
}

 

- placehold.it

아직 이미지가 없을 때 원하는 크기의 이미지를 넣을 수 있다.

800*1500 사이즈

<img src="http://placehold.it/800x1500">

 

- 설정

boxClass: '클래스명',       

 

// animation css 사용 o 

animateClass: 'animated' 


// default 0, 150px 정도 지나서 애니메이션이 나타난다.
offset:  150,           

// 디폴트 값 
wow = new WOW({
    boxClass:     'wow',      // default
    animateClass: 'animated', // default
    offset:       0,          // default
    mobile:       true,       // default
    live:         true        // default
    })
    wow.init();
    
// js    
wow = new WOW({
    boxClass:     'wow', 
    offset:       150,         
    mobile:       true,       
    live:         true       
    })
    wow.init();

 

 

 

+ Recent posts