codecamp

HTML DOM Style animationDuration 属性

Style animationDuration 属性

Style 对象参考手册 Style 对象

实例

改变 <div> 元素的 animationDuration 属性:

document.getElementById("myDIV").style.animationDuration="3s";

尝试一下 »

定义和用法

animationDuration 属性定义动画完成一个周期需要花费的秒数。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

只有 Firefox 支持 animationDuration 属性。


语法

返回 animationDuration 属性:

object.style.animationDuration

设置 animationDuration 属性:

object.style.animationDuration="time|initial|inherit"

属性值

描述
time 规定动画完成的长度。默认值为 0,意味着没有动画。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

技术细节

默认值: 0
返回值: 字符串,表示元素的 animation-duration 属性。
CSS 版本 CSS3


相关文章

CSS 参考手册:animation-duration 属性


Style 对象参考手册 Style 对象

温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

HTML DOM对象

HTML DOM 引用对象

HTML DOM Password 对象

HTML DOM Link 对象

HTML DOM Select 对象

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }