如何为firefox浏览器访问object.style.filter

How to access object.style.filter for firefox browser?

本文关键字:object style filter 访问 浏览器 firefox      更新时间:2023-09-26

我使用的是object.style.filter='Gray', object.style.filter='fliph', object.style.filter='flipv', object.style.filter='invert',这在IE中工作,但在firefox中不起作用。你能帮帮忙吗?

Firefox中的.style.filter公开了SVG定义的filter CSS属性。此属性的有效值不包括'Gray'。参见http://www.w3.org/TR/SVG11/filters.html#FilterProperty和https://developer.mozilla.org/en/applying_svg_effects_to_html_content#Example.3a.c2.a0Filtering

过滤器是特定于IE的。CSS可以在IE和FF中设置颜色:

object.style.backgroundColor = 'gray'

如果你的目标是为整个div着色,你最好的选择是创建一个覆盖第一个div的新div,并且是部分透明的