【发布时间】:2014-07-07 08:39:37
【问题描述】:
是否可以在 ext.js 5.0.0 中在所有状态下覆盖按钮背景图像:正常、悬停、按下?我尝试使用以下 css 代码但没有成功:
.fieldNameCls
{
}
.fieldDataCls
{
}
.x-btn.removeButtonCls {
width: 26px;
height: 26px;
// background-color: transparent !important;
background: url('images/RemoveDetailButton.png') no-repeat;
background-size: contain !important;
border-style: none !important;
border-radius: 0px !important;
}
.x-btn-over.removeButtonCls {
width: 26px;
height: 26px;
background: url('images/RemoveDetailButtonHover.png') no-repeat;
background-size: contain !important;
border-style: none !important;
border-radius: 0px !important;
}
.x-btn-pressed.removeButtonCls {
width: 26px;
height: 26px;
background: url('images/RemoveDetailButtonPressed.png') no-repeat;
background-size: contain !important;
border-style: none !important;
border-radius: 0px !important;
}
js按钮定义如下:
{
xtype: 'button',
itemId: 'removeButton',
cls: 'removeButtonCls',
// style: 'background:url("resources/images/RemoveDetailButton.png") no-repeat; background-size: 100% !important; border-style: none !important;border-radius: 0px !important;',
// style: 'background:none !important; border-style: none !important;border-radius: 0px !important;',
margin: '10 10 0 0'
}
我试图了解要覆盖哪些类,但无法理解 Ext.js 每个按钮使用的所有 div/span ... ;)
如果我只使用一些 HTML 按钮,它会更容易覆盖,但作为网页设计的新手,我不确定如何从该按钮获取事件/更改文本...
谢谢
【问题讨论】:
-
试试这个对你有帮助
http://stackoverflow.com/questions/17608270/extjs-changing-default-button-styles-and-fonts -
他们提供了如何将图像添加到按钮的示例。但是 Ext.js 按钮有多种我不需要的样式/层。我想要的只是一个像样的图像按钮,它有 3 种状态:正常、悬停、按下。我希望它是方形的,没有样式,每个州只有一张图片。我应该只使用 HTML 按钮作为自定义组件吗?
标签: javascript css extjs extjs5