Thuộc tính AnimationEvent animationName Property
Ví dụ
Lấy tên hoạt ảnh được liên kết với hoạt ảnh:
const div = document.getElementById("myDIV");
div.addEventListener("animationstart", myStartFunction);
function myStartFunction(event) {
this.innerHTML = "Animation-name is: " + event.animationName;
}
Hãy tự mình thử »Sự miêu tả
Thuộc tính animationName
trả về tên của hoạt ảnh khi xảy ra sự kiện hoạt ảnh.
Thuộc tính animationName
là chỉ đọc.
Thuộc tính animationName
là giá trị của thuộc tính CSS tên hoạt hình .
Sự kiện hoạt hình
Event | Occurs When |
---|---|
animationstart | A CSS animation has started |
animationend | A CSS animation has completed |
animationiteration | A CSS animation is repeated |
Thuộc tính hoạt hình
Property | Description |
---|---|
animationName | The name of the animation |
elapsedTime | The number of seconds an animation has been running |
pseudoElement | The name of the pseudo-element of the animation |
Xem thêm:
Đối tượng sự kiện hoạt hình
Thuộc tính hoạt hình Phong cách
Hướng dẫn:
Cú pháp
event .animationName
Chi tiết kỹ thuật
Giá trị trả về: | Một chuỗi. Tên của phim hoạt hình. |
---|---|
Phiên bản DOM: | Sự kiện hoạt ảnh DOM cấp 3 |
Hỗ trợ trình duyệt
event.animationName
là tính năng DOM cấp 3 (2004).
Nó được hỗ trợ đầy đủ trong tất cả các trình duyệt hiện đại:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |