css - 灰度到颜色的过渡在 Firefox 中不起作用

标签 css firefox css-transitions transition

.picture-box img {

display: inline-block;
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 3.5+ */
filter: gray; /* IE6-9 */
filter: grayscale(100%);
-webkit-filter: grayscale(1);
-moz-filter: grayscale(1);
-o-filter: grayscale(1);
-ms-filter: grayscale(1);

.picture-box img:hover {

filter: none; /* IE6-9 */
filter: grayscale(0);
-webkit-filter: grayscale(0);
-moz-filter: grayscale(0);
-o-filter: grayscale(0);
-ms-filter: grayscale(0);

-webkit-transition: all 2.0s ease-out;
-moz-transition: all 2.0s ease-out;
-ms-transition: all 2.0s ease-out;
-o-transition: all 2.0s ease-out;
transition: all 2.0s ease-out;

这段代码有什么问题?过渡在 Firefox 中不起作用。我安装了 21.0。

最佳答案

尝试将 .picture-box img:hover 设置为:

 filter:grayscale(0%); 
 -webkit-filter: grayscale(0%);
 filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale");

您可以在这里查看。 http://www.cheesetoast.co.uk/add-grayscale-images-hover-css-black-white/

关于css - 灰度到颜色的过渡在 Firefox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16744894/

相关文章:

javascript - 文件下载 - 如何控制文件名并尊重用户偏好?

jquery - 在 jQuery 中使用动画旋转

html - CSS 位置 Sticky 和 ​​Z-Index overlay/modal

CSS: div 不会向左浮动 (float: left)

css - Kindle Fire 8.9 HDX 媒体查询

c# - Selenium 为什么将 acceptuntrustedcertificates 设置为 true 对于 firefox 驱动程序不起作用?

jquery - 滚动上的固定元素有问题

javascript - Firefox DevTools : Tabs & How to keep debugger files open after page reload/refresh?(停止自动关闭)

javascript - 从屏幕外滑入移动菜单 - 溢出问题

html - CSS 过渡闪烁