如何制作仅自定义图标的 jQuery UI 按钮小部件?
我正在尝试用 jQuery UI 来替代其他 RIA 技术,但我想制作一个仅图标按钮。我知道我们可以使用默认的主题滚轮图标来做到这一点,但我想使用我自己的图标。
我已成功创建(请参阅此处)带有自定义图标和文本的自定义按钮,但如果我删除文本,它就会变得不成比例且丑陋。
我尝试将
包装在
中,然后在其上调用 .button()
但它得到太大;我真正想要的是有一个图标按钮,就像主题附带的图标按钮一样,但使用我自己的图标。希望我已经说得清楚易懂,
FA
(想想 extJS 仅图标按钮或 Adobe Flex(你为什么抛弃我)仅图标按钮)
I'm trying my hand at jQuery UI as a replacement for other RIA techniques but I wanted to make an icon-only button. I'm aware that we can do it using the default theme-roller icons but I want to use my own icons.
I've successfully created (see here) a custom button with a custom icon and text, but if I remove the text then it becomes disproportionate and ugly.
I've tried just wrapping an <img>
in a <div>
and then calling .button()
on it but it gets too large; what I really wanted is to have an icon-button like the ones that ship with the theme but using my own icons instead.
Hoping I've made myself clear and understandable,
FA
(think extJS icon-only buttons or Adobe Flex (why have you forsaken me) icon-only buttons)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎对我有用(改编自演示此处以及您提到的答案)。看起来关键是将
text
选项设置为false
:JavaScript:
CSS:
示例: http://jsfiddle.net/ReKbf/
(对糟糕的占位符图像表示歉意)
This seems to work for me (adapted from the demo here and the answer you mentioned). It looks like the key is setting the
text
option tofalse
:JavaScript:
CSS:
Example: http://jsfiddle.net/ReKbf/
(Apologies for the terrible placeholder image)