在以 Quirks 模式运行的 IE11 中使用 css 制作灰度图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35711940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make a grayscale image with css in IE11 running in Quirks mode
提问by Zymus
I need to convert some colorful images on an internal legacy web application to grayscale. I figured the easiest way would be to use CSS filters. The users of this application access it via IE11 due to a Group Policy. This application must also be run using Quirks (IE5) document mode, otherwise crazy things happen (rendering issues, javascript not working, etc).
我需要将内部遗留 Web 应用程序上的一些彩色图像转换为灰度。我认为最简单的方法是使用 CSS 过滤器。由于组策略,此应用程序的用户通过 IE11 访问它。此应用程序还必须使用 Quirks (IE5) 文档模式运行,否则会发生疯狂的事情(渲染问题、javascript 不工作等)。
I have tried the following code (as well as code from here, here, and here)
img.desaturate {
-webkit-filter: grayscale(100%);
filter: gray;
filter: grayscale(100%);
filter: url(desaturate.svg#greyscale);
}
with no effect. Given this criteria (IE11 running with IE5 Document mode), is there anything I can do to get these grayscale images, and if so, how?
没有效果。鉴于此标准(IE11 以 IE5 文档模式运行),我可以做些什么来获取这些灰度图像,如果可以,如何获取?
note: redesigning the application to work with more modern technologies is not currently funded, and will not be in the future.
注意:重新设计应用程序以使用更现代的技术目前没有资金,将来也不会。
note: converting each image to grayscale with some script and saving the output is also not an option, as there are millions of images available.
注意:使用一些脚本将每个图像转换为灰度并保存输出也不是一种选择,因为有数百万个图像可用。
Link to example that shows colorful Google logo: https://jsfiddle.net/bq2mw5ya/2/
链接到显示彩色 Google 徽标的示例:https: //jsfiddle.net/bq2mw5ya/2/
回答by G-Cyrillus
actually i turn my comment as an answer for feed back:
实际上,我将我的评论作为反馈的答案:
IE specific filter should stand last, so it is not overide by a next one.
IE 特定过滤器应该放在最后,所以它不会被下一个过滤器覆盖。
Activex should also allowed to run
Activex 也应该允许运行
and of course, it should be in quirk mode ...
当然,它应该处于怪癖模式......
img.desaturate {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
filter: url(desaturate.svg#greyscale);
filter: gray;
}