从 jQuery UI 获取突出显示的彩色图标作为项目符号点?
在我的 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; }
我想要的颜色在 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>
我可以 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>
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; }
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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你只想获取特定 ui-state 的图标,你可以这样做:
它的作用是在 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:
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.