問(wèn)題描述
我想使用 jquery-grayscale將圖像顏色轉(zhuǎn)換為各自的灰度.使用很簡(jiǎn)單,識(shí)別圖片并應(yīng)用插件:
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'); }
謝謝.-
當(dāng)然,將這些圖標(biāo)轉(zhuǎn)換為灰度的任何其他方式也很有用.有什么想法嗎?
Of course any other way to convert to grayscale these icons is useful too. Any idea?
推薦答案
我想你正在使用 這個(gè)插件?查看代碼,它似乎只支持 <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.
這篇關(guān)于如何將灰度 jquery 插件應(yīng)用于背景圖像?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!