如何将灰度 jquery 插件应用于背景图像?

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

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
ExecJS::ProgramError: SyntaxError: Reserved word quot;functionquot;(ExecJS::ProgramError: SyntaxError: 保留字“function)
Infinite scroll and will_paginate appending the #39;next page#39; of items multiple times(无限滚动和 will_paginate 多次附加项目的“下一页)
What is cleanest way to turn Array of JQuery Promises into a JQuery Promise of an Array?(将 JQuery Promise 数组转换为数组的 JQuery Promise 的最简洁方法是什么?)
Scale background image to fit ie8 window(缩放背景图像以适合 ie8 窗口)
How to onclick-trigger a non-native jQuery plugin#39;s action?(如何点击触发非本地 jQuery 插件的操作?)