从 jQuery UI 获取突出显示的彩色图标作为项目符号点?

发布于 2024-11-17 02:30:34 字数 1667 浏览 0 评论 0原文

在我的 jQuery themebuilder 构建的主题中,我有 5 个不同的 ui-icons_* 文件。 其中两个是与高光颜色相对应的橙色阴影。 我想使用橙色图标作为项目符号。

我的第一次尝试将图标放在它自己的行上。

<div class="heading">
    <span class="ui-icon ui-icon-triangle-1-e" ></span>
    Meeting
</div>

我的第二次尝试给出了图标,但未正确对齐。

<div class="heading">
    <span class="ui-icon ui-icon-triangle-1-e" style="display:inline-block"></span>
    Meeting
</div>

添加以下样式使文本与图标对齐:

.heading { vertical-align: top; }

http://jsfiddle.net/rypyP/1/

我想要的颜色在 ui-state-active 集中,所以如果我将该状态添加到包含单元中,它将获得正确的颜色,但对于整个 enchilada (边框、背景颜色、文本颜色),我只想项目符号点橙色。

<div class="heading ui-state-active">
    <span class="ui-icon ui-icon-triangle-1-e" style="display:inline-block"></span>
    Meeting
</div>

http://jsfiddle.net/MEXQV/1/

我可以 jQuery 主题中特定 ui 状态的图标,而不重写 css?

如果不可能,您建议采用什么方式?为什么?

解决方案

样式表:

.heading
{
    vertical-align: top;
}

Html:

<div class="heading">
    <span class="ui-state-active" style="border: 0px">
        <span class="ui-icon ui-icon-triangle-1-e" style="display:inline-block; border: 0px">
        </span>
    </span>
    Meeting
</div>

http://jsfiddle.net/rypyP/4/

In my jQuery themebuilder built theme I have 5 different ui-icons_* files.
Two of them are in an orange shade corresponding to the highlight color.
I want to use an orange icon as a bullet.

My first attempt gives the icon on it's own row.

<div class="heading">
    <span class="ui-icon ui-icon-triangle-1-e" ></span>
    Meeting
</div>

My second attempt gives the icon but not aligned properly.

<div class="heading">
    <span class="ui-icon ui-icon-triangle-1-e" style="display:inline-block"></span>
    Meeting
</div>

Adding the following style makes the text align with the icon:

.heading { vertical-align: top; }

http://jsfiddle.net/rypyP/1/

The color i want is in the ui-state-active set, so if I add that state to the containing unit it gets the correct color, but with the whole enchilada (border, background color, text color) and I just want the bullet point orange.

<div class="heading ui-state-active">
    <span class="ui-icon ui-icon-triangle-1-e" style="display:inline-block"></span>
    Meeting
</div>

http://jsfiddle.net/MEXQV/1/

Can I get just the icon from a particular ui-state in a jQuery theme without rewriting the css?

If that is not possible, what way would you suggest and why?

SOLUTION

Stylesheet:

.heading
{
    vertical-align: top;
}

Html:

<div class="heading">
    <span class="ui-state-active" style="border: 0px">
        <span class="ui-icon ui-icon-triangle-1-e" style="display:inline-block; border: 0px">
        </span>
    </span>
    Meeting
</div>

http://jsfiddle.net/rypyP/4/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑咖 2024-11-24 02:30:34

如果你只想获取特定 ui-state 的图标,你可以这样做:

<div class="heading">
<span class="ui-state-active ui-icon ui-icon-triangle-1-e " style="display:inline-block"></span>
Meeting</div>

它的作用是在 jQuery 的默认主题图标集上查找指定的图标(默认情况下它有四个图标集 - active、default、突出显示和错误)。如果你想删除边框等,你必须在你自己的 CSS 中重写 ui-state 类,例如:添加 .ui-state-active { border: 0px;谢谢

If you just want to get the icon of a particular ui-state, you can do this:

<div class="heading">
<span class="ui-state-active ui-icon ui-icon-triangle-1-e " style="display:inline-block"></span>
Meeting</div>

What it does is it will look the specified icon on jQuery's default theme icon set (it has four icon sets by default -- active, default, highlight, and error). If you want to remove the borders etc, you'll have to override the ui-state class in your own css, e.g: adding .ui-state-active { border: 0px; }

Thanks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文