我无法通过jquery删除灰度

我无法通过jquery删除灰度,jquery,css,grayscale,Jquery,Css,Grayscale,我的css代码 .content-img { -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; -ms-transition: all 1s ease; transition: all 1s ease; -webkit-filter:grayscale(100%); } 我的jq

我的css代码

.content-img  {
    -webkit-transition: all 1s ease;
     -moz-transition: all 1s ease;
       -o-transition: all 1s ease;
      -ms-transition: all 1s ease;
          transition: all 1s ease;
         -webkit-filter:grayscale(100%); 
}
我的jquery

 $('.content-img').hover(function () {
        $(this).css('-webkit-filter', 'grayscale(0)');
    });

我只是想写jQuery。它不起作用。

为什么需要使用jQuery

您可以使用以下选项:

.content-img:hover {
    -webkit-filter: grayscale(0%);
            filter: grayscale(0%);
}
在这里,我只使用css,使用
:hover
选择器创建了这个


但是要小心,
filter
的支持有限,请看。

我认为您需要使它更具体。.它在这里工作正常-(在Chrome中)事实上,当您将鼠标移到img上时,它工作正常,但移出不会将其更改回来,请尝试此操作,注意您使用的是
hover()
方法错误。为什么不使用CSS本身:@abhitalks是的,您可以绑定1或2个处理程序(1个用于鼠标输入,1个用于鼠标输出)。没有提到它应该返回原始状态。