使用modernizer,我怎样才能为css3动画提供一个回退,回退到flash?
我是一个新的现代化者,不明白如何隐藏我的css动画,如果css动画不受支持,并显示一个flash副本。我知道我用使用modernizer,我怎样才能为css3动画提供一个回退,回退到flash?,css,html,modernizr,Css,Html,Modernizr,我是一个新的现代化者,不明白如何隐藏我的css动画,如果css动画不受支持,并显示一个flash副本。我知道我用 if (Modernizer.cssanimation) 但是不理解if语句中需要什么代码结构 非常感谢您不需要在JavaScript中执行此操作。您可以使用CSS代码。Modernizr将css类添加到标记中,以显示功能是否受支持。对于动画,它是cssanimations。在Modernizer完成他的工作后,Firefox20中的HTML标记看起来像 <html clas
if (Modernizer.cssanimation)
但是不理解if语句中需要什么代码结构
非常感谢您不需要在JavaScript中执行此操作。您可以使用CSS代码。Modernizr将css类添加到
标记中,以显示功能是否受支持。对于动画,它是cssanimations
。在Modernizer完成他的工作后,Firefox20中的HTML标记看起来像
<html class=" js no-flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths">
并使用cssanimations
类覆盖样式以显示css动画:
.cssanimations #flash {
display: none;
}
.cssanimations #css {
display: initial;
}
并使用IE8或更低版本以及类似Chrome的兼容浏览器进行测试。IE显示“这是Flash动画”,而Chrome显示“这是CSS动画”
当然,这只有在启用JavaScript时才有效。使用禁用的JavaScript,即使在现代浏览器中也可以看到Flash动画
#css {
display: none;
}
.cssanimations #flash {
display: none;
}
.cssanimations #css {
display: initial;
}