javascript - CSS -webkit-filter 在 Chrome 22.0 中不起作用

标签 javascript css google-chrome filter webkit

我有这段代码,但它无法在 Chrome 22.0.1229.94 m 上运行。

<div id='botonera'>
    <button id='restaurar'>Restaurar</button>
    <button id='blur'>Blur</button>
    <button id='greyscale'>Greyscale</button>
    <button id='sepia'>Sepia</button>
</div>

<script type="text/javascript">
    var imagen = document.getElementById('imagen');

    document.getElementById('restaurar').onclick = function() {
        imagen.className = 'restaurar';
    }
    document.getElementById('blur').onclick = function() {
        imagen.className = 'blur';
    }
    document.getElementById('greyscale').onclick = function() {
        imagen.className = 'greyscale';
    }
    document.getElementById('sepia').onclick = function() {
        imagen.className = 'sepia';
    }
</script>

只有灰度不起作用,模糊、棕褐色和“恢复”工作得很好。谢谢!

最佳答案

您可能正在拼写 gr<b>a</b>yscale作为gr<b>e</b>yscale在你的 CSS 中。两种拼写都正确,但只有第一种有效。

.greyscale {  
   -webkit-filter: grayscale(100%);
}

关于javascript - CSS -webkit-filter 在 Chrome 22.0 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13061652/

相关文章:

javascript - 如何在 Javascript 的个人加密中获得无限字符

javascript - 为什么imagepicker程序js中的这个功能不起作用?

CSS - 垂直居中的 div 忽略父 padding-bottom

php - HTML:单引号在本网站上显示为空格,但仅在某些浏览器中显示(即在桌面上的 Chrome 中,但在 iOS 上的 Safari 中不显示)

javascript - 为什么不同操作系统上的decodeAudioData()结果不同

javascript - 如何用户异步守护?

javascript - Bootstrap Dropdown - 使用地毯作为按钮

jquery - 使用 jQuery 更改标记和不同 CSS 文件的 CSS 属性

html - svg text transform-rotate 更改文本标签的 x 和 y 位置

javascript - 加快 Chrome 中测试的运行速度