如何将灰度 jquery 插件应用于背景图像?
我想使用 jquery-grayscale将图像颜色转换为各自的灰度.使用很简单,识别图片并应用插件:
I want to use the jquery-grayscale that converts images colors to their respective grayscale. Use it is very simple, identify the image and apply the plugin:
$('#my-icon').grayscale()
但是如果图片在css文件中定义为background-image怎么办呢?
But how to do it if the image is defined in a css file as a background-image?
#my-icon{ background-image:url('../Images/my-icon.png'); }
谢谢.-
当然,将这些图标转换为灰度的任何其他方式也很有用.有什么想法吗?
Of course any other way to convert to grayscale these icons is useful too. Any idea?
推荐答案
我想你正在使用 这个插件?查看代码,它似乎只支持 <img src="...">
图像,因此您要么必须修改它,要么希望其他人这样做.
I suppose you are using this plugin? Looking at the code it only seems to support <img src="...">
images so you'll either have to modify it or hope that someone else does.
相关文章