null字符串和none字符串的区别

difference between null string and none

本文关键字:字符串 区别 null none      更新时间:2023-09-26

我有以下脚本:

document.querySelector(".img-man").style.webkitAnimation = "";

可以在safari 5.1.7上运行,但不能在7.0.2上运行。

后来改成了:

document.querySelector(".img-man").style.webkitAnimation = "none";

现在工作正常

我很想知道"" and "none"

将属性设置为"none"明确禁用动画。

链接

"那么现在它不能在5.1.7中工作。那么,我该怎么办呢?"

"none"不工作的问题也许可以通过使用虚拟名称来修复:

document.querySelector(".img-man").style.webkitAnimation = "dummy";

由于这是通过JavaScript完成的,另一种方法可以是:

document.querySelector(".img-man").style.removeProperty('-webkit-animation-name');

OK。OP在我写完之后删除了问题的这一部分,但留下它,因为它可能对他和其他人都有帮助。


属性本身;在Safari文档中我们有webkit-animation的子属性-webkit-animation-name:

-webkit-animation-name

  指定动画的名称。

语法

-webkit-animation-name: name[,…]
参数


名字,


该名称用于选择-webkit-keyframe规则,该规则为动画提供关键帧和属性值。如果名称与任何-webkit-keyframe规则不匹配,则没有要动画的属性,并且动画不会执行。请参见"@-webkit-keyframes"了解此规则的描述。

如果"none",则不会执行动画,即使有一个带有该名称的-webkit-keyframe规则。将此属性设置为none将显式禁用动画。

默认值为"。