如何指定(覆盖)JQuery图标颜色 [英] How To Specify (Override) JQuery Icon Color

查看:768
本文介绍了如何指定(覆盖)JQuery图标颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用jQuery的图标在我的网络应用程序,但已经到了一个点,我想使用一种颜色,我不能实现默认情况下。我目前使用的状态街主题,主要使用绿色。但我有一个白色文本的红色框,并希望使用一个白色的图标。有与主题一起提供的白色图标,但它们只有在图标位于具有ui-state-focus类的div(或其他容器)内时才会应用。这将使图标变白,但会将背景颜色更改为绿色,我想将其保留为红色。

I've been making good use of the jQuery icons in my web app, but have come to a point where I would like to use a color that I'm not able to achieve by default. I'm currently using the "State Street" theme, which primarily uses green. But I have a red box with white text, and would like to use an icon that is white as well. There are white icons that are supplied with the theme, but they only get applied when the icons are inside a div (or some other container) that has a class of "ui-state-focus". This will make the icon white, but will change the background color to green, which I want to leave as red.

有任何方式覆盖jQuery用于图标的背景图片,以便我可以使用不同的颜色?

Is there any way (most likely via CSS) to override what background image jQuery uses for the icons, so that I can use a different color?

谢谢。

澄清:我想这将有助于我发布我目前使用的HTML:

CLARIFICATION: I guess it would help for me to post the html I'm currently working with:

<!-- currently produces a default 'grey' icon color -->
<!-- this b/c no jquery ui class (like ui-state-focus) given for errorMessage div -->
<div id="errorMessage">
    <span class="ui-icon ui-icon-alert" style="float: left"></span>
    Only 1 Activity can be added at a time 
</div>

我也有CSS:

.dialog #errorMessage
{
    /*display: none;*/
    background-color: #CC3300;
    color: #FFFFFF;
    font-weight: bold;
    padding-top: 3px;
    padding-bottom: 3px;
    vertical-align: bottom;
    bottom: auto;
    font-size: .80em;
    width: 100%
}

display:none因此我可以看到它。我有它设置为fadeIn错误捕获。再次感谢您的帮助。

"display: none" is currently commented out so I can see it. I do have it set up to fadeIn on error catch. Thanks again for the help.

推荐答案

您可以使用以下CSS覆盖图标:

You can overwrite the icons with the following CSS:

.ui-icon
{
    background-image: url(icons.png);
}

您可以以任何喜欢的颜色下载图标png文件。只需更改以下网址中的颜色部分:

You can download the icon png file in any color you like. Just change the color part in the following url:

http://download.jqueryui.com/themeroller/images/ui-icons_*COLOR*_256x240.png

例如,如果您想要红色图标和矢车菊蓝色图标,您需要的网址是:

For example, if you want Red icons, and Cornflower Blue icons, the URLs you need are:

http://download.jqueryui.com/themeroller/images/ui-icons_ff0000_256x240.png
http://download.jqueryui.com/themeroller/images/ui-icons_6495ED_256x240.png


等。

作为CDN,很好,并在本地保存文件)

(but don't use the URL as a CDN, be nice and save the files locally)

这篇关于如何指定(覆盖)JQuery图标颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆