• 회원가입
  • 로그인
  • 구글아이디로 로그인

[DOM_Event] JS - animationend 이벤트 (= onanimationend 속성) - 애니완료이벤트 (= 애니종료이벤트, IE10)

animationend 예제

 

<style> 

#hz {

  margin: 25px;

  width: 400px;

  line-height: 100px;

  text-align:center;

  background: yellow;

  position: relative;

  font-size: 20px;

}


/* Chrome, Safari, Opera */

@-webkit-keyframes hzmove {

  from {top: 0px;}

  to {top: 200px;}

}


@keyframes hzmove {

  from {top: 0px;}

  to {top: 200px;}

}

</style>



<div id="hz" onclick="homzzang()">홈짱닷컴 Homzzang.com [클릭]</div>


<script>

var x = document.getElementById("hz");


// Start the animation with JavaScript

function homzzang() {

  x.style.WebkitAnimation = "hzmove 4s 2"; // Code for Chrome, Safari and Opera

  x.style.animation = "hzmove 4s 2";     // Standard syntax

}


// Chrome, Safari and Opera

x.addEventListener("webkitAnimationStart", homzzangStart);

x.addEventListener("webkitAnimationIteration", homzzangRepeat);

x.addEventListener("webkitAnimationEnd", homzzangEnd);


// 표준

x.addEventListener("animationstart", homzzangStart);

x.addEventListener("animationiteration", homzzangRepeat);

x.addEventListener("animationend", homzzangEnd);


function homzzangStart() {

  this.innerHTML = "animationstart 이벤트 - 이동 시작";

  this.style.backgroundColor = "tomato";

}


function homzzangRepeat() {

  this.innerHTML = "animationiteration 이벤트 - 이동 반복";

  this.style.backgroundColor = "pink";

}


function homzzangEnd() {

  this.innerHTML = "animationend 이벤트 - 이동 종료";

  this.style.backgroundColor = "lightgray";

}

</script> 

 

결과보기


 

animationend 정의

 

 CSS 애니메이션 완료될 때 발생.

 


 

1.

CSS3 animation 참조.

 

2.

관련 이벤트 3가지.

 

animationstart

CSS 애니메이션 시작 때 발생.

 

animationiteration

CSS 애니메이션 반복 때 발생.

 

animationend

CSS 애니메이션 완료 때 발생.


3.

IE10 이상 주요 최신 브라우저 지원.
Chrome, Safari, Opera 접두어: webkit

Firefox 접두어 : moz

 

4.

이벤트확산 : O
취소가능성 : X

이벤트타입 : AnimationEvent

지원 HTML : 

DOM 버전 : Level 3 Events

 

 

 

animationend 구문

 

object.addEventListener("webkitAnimationEnd", homzzang);  // Chrome, Safari, Opera

object.addEventListener("animationend", homzzang); // Standard

 

※ homzzang : 실행함수명.

※ addEventLister() 방식 주의사항 2가지 : (이벤트명에 on 안 붙인. / 실행함수명 뒤에 소괄호 안 붙임)

※ addEventListener() 메서드는 IE8 및 그 이전 브라우저는 지원 안 함. 



분류 제목
Window_Location JS - host 속성 ★ - (호스트명/포트번호)
Window_Location JS - hostname 속성 - 호스트명
Window_Location JS - href 속성 ★ - 현재URL주소전체 (+ 특정URL주소이동설정)
Window_Location JS - origin 속성 - (프로토콜/호스트명/포트번호) 반환. (= origin속성 = 오리진속성)
Window_Location JS - pathname 속성 ★ - 도메인뒤의 URL경로 (= 도메인뒤주소경로)
Window_Location JS - port 속성 - 포트번호
Window_Location JS - protocol 속성 - 프로토콜
Window_Location JS - search 속성 ★ - URL쿼리스트링 (= URL주소중물음표이하주소)
Window_Location JS - assign() 메서드 ★★ - 새 웹문서 로드 (= 주소이동 = assign메서드 = 어사인 메서…
Window_Location JS - reload() 메서드 ★ - 페이지 새로고침 (= reload메서드 = 리로드메서드) ※ 윈도우…
Window_Location JS - replace() 메서드(※ Location용) ★★ - 새 웹문서 로드. (= 주소이동 = rep…
Window_Navigator JS - appCodeName 속성 - 브라우저코드명 (= 브라우저코드이름) 반환
Window_Navigator JS - appName 속성 - 브라우저명 반환 (= appName속성 = 앱네임속성) ※ 브라우저이름 확인…
Window_Navigator JS - navigator.appVersion 속성 - 브라우저버전 반환 (= navigator.appVer…
Window_Navigator JS - navigator.cookieEnabled 속성 - 브라우저 쿠키 사용 여부 결정 (= 네비게이터쿠…
Window_Navigator JS - geolocation -
Window_Navigator JS - navigator.language 속성 ★ - 브라우저 언어 반환 (= navigator.langu…
Window_Navigator JS - onLine -
Window_Navigator JS - navigator.platform 속성 - 브라우저가 컴파일 된 플랫폼 반환 (= 네비게이터플랫폼속…
Window_Navigator JS - product 속성 - 브라우저 엔진이름 (IE11 이상)
41/67
목록
찾아주셔서 감사합니다. Since 2012