How to apply the grayscale jquery plugin to a background image?(如何将灰度 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.
这篇关于如何将灰度 jquery 插件应用于背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将灰度 jquery 插件应用于背景图像?


基础教程推荐
- npm start 错误与 create-react-app 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01