Latest web development tutorials

HTML DOM Style animationName 屬性

Style 對象參考手冊 Style對象

實例

改變<div> 元素的animationName 屬性:

document.getElementById("myDIV").style.animationName="myNEWmove";

嘗試一下»

定義和用法

animationName 屬性設置或返回@keyframes 動畫的名稱。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10、Firefox 和Opera 支持animationName 屬性。

Safari 和Chrome 支持另一個可替代該屬性的屬性,即WebkitAnimationName 屬性。

注意: Internet Explorer 9及其之前的版本不支持animationName屬性。


語法

返回animationName 屬性:

object .style.animationName

設置animationName 屬性:

object .style.animationName="none|keyframename|initial|inherit"

屬性值

描述
none 默认值。规定没有动画(可用于重写来自级联的动画)。
keyframename 规定要绑定到选择器的关键帧的名称。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

技術細節

默認值: none
返回值: 字符串,表示元素的animation-name 屬性。
CSS 版本 CSS3


相關文章

CSS參考手冊: animation-name屬性


Style 對象參考手冊 Style對象