如何使用jquery检查元素的背景颜色 [英] How to check the background-color of an element using jquery
本文介绍了如何使用jquery检查元素的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if($(this).css("background-color")==Crimson)
这是正确的吗? .css(background-color,white)将改变颜色,但我不想改变,我想知道它是哪种颜色。
is this correct ? .css("background-color","white") will change the color, but I don't want to change, I wanna know which color it is.
推荐答案
它像这样工作
if($(#notify-9)。css background-color')==rgb(220,20,60))alert(matched);
将名称转换为红色,绿色,蓝色组件,您可以使用此工具
you need to convert name to red, green, blue components, you might use this tool
http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php
这篇关于如何使用jquery检查元素的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文