--- title: visibilitychange slug: Web/API/Document/visibilitychange_event tags: - API - Event - Reference - Web translation_of: Web/API/Document/visibilitychange_event ---
{{APIRef}}

visibilitychange 이벤트는 브라우저 탭의 컨텐츠가 visible 또는 hidden 상태로 변화할 때 발생된다.

Bubbles Yes
Cancelable No
Interface {{domxref("event")}}
Event handler property {{domxref("Document.onvisibilitychange", "onvisibilitychange")}}

예제

document.addEventListener("visibilitychange", function() {
  console.log( document.visibilityState );
});

명세

Specification Status Comment
{{SpecName('Page Visibility API','#sec-visibilitychange-event','visibilitychange')}} {{Spec2('Page Visibility API')}}  

브라우저 호환성

{{Compat("api.Document.visibilitychange")}}

같이 보기