将jQuery图标颜色更改为白色而不是灰色 [英] Change jQuery icon color to white instead of gray

查看:346
本文介绍了将jQuery图标颜色更改为白色而不是灰色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net mvc项目中使用jQuery图标.通常,我使用灰色图标,但现在我想要一个蓝色按钮的白色图标(见下文).

I use jQuery icons in my asp.net mvc project. Usually I use gray icons but now I would like a white icon for my blue button (see below).

这是我使用的代码:

$(".editUser").button({ icons: { primary: "ui-icon-pencil"} });
$(".deleteUser").button({ icons: { primary: "ui-icon-trash"} });

如何将图标颜色更改为白色?

谢谢

推荐答案

您可以使用该图标集上使用的精灵:

you can play around with the sprite used on that icon set:

白色图标集(ui-icons_ffffff_256x240.png)

将精灵存储在某个地方,然后在样式表中引用它,您可以将其应用于蓝色按钮:

Store that sprite somewhere, then reference it in a style sheet you can apply to the blue buttons:

.ui-icon-white {
  background-image: url("images/ui-icons_ffffff_256x240.png");
}

然后,当您要设置白色图标时,请应用该样式:

Then when you want a white icon set, apply that style:

<span class="ui-icon ui-icon-white ui-icon-pencil"></span>

这篇关于将jQuery图标颜色更改为白色而不是灰色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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