SplitButton(分割按钮)
扩展自$.fn.iLinkbutton.defaults。用于$.fn.iSplitbutton.defaults重写默认值对象。
类似菜单按钮,分割按钮也与linkbutton和菜单有关系。menubutton和splitbutton之间的区别是,splitbutton分为两部分。它只会在鼠标移动到splitbutton按钮右边的时候才会显示出"分割线"。
依赖关系
用法
使用标签创建分割按钮。
html
<a href="javascript:void(0)" id="sb" data-toggle="topjui-splitbutton" data-options="menu:'#mm',iconCls:'icon-ok'" onclick="javascript:alert('ok')">Ok</a>
<div id="mm" style="width:100px;">
<div data-options="iconCls:'icon-ok'">Ok</div>
<div data-options="iconCls:'icon-cancel'">Cancel</div>
</div>1
2
3
4
5
2
3
4
5
使用Javascript创建分割按钮。
javascript
$('#sb').iSplitbutton({
iconCls: 'icon-ok',
menu: '#mm'
});1
2
3
4
2
3
4
属性
分割按钮属性扩展自 linkbutton,分割按钮新增的属性如下:
| 属性名 | 属性值类型 | 描述 | 默认值 |
|---|---|---|---|
| iconCls | string | 显示在按钮文字左侧的图标(16x16)的CSS类。(如:fa fa-book) | null |
| btnCls | string | 按钮样式,内置的样式有:topjui-btn-green/red/brown/black/blue/orange/purple | null |
| plain | boolean | 设置为true将显示简洁效果。 | true |
| menu | string | 用来创建一个对应菜单的选择器。 | null |
| duration | number | 定义鼠标划过按钮时显示菜单所持续的时间,单位为毫秒。 | 100 |
方法
| 方法名 | 方法参数 | 描述 |
|---|---|---|
| options | none | 返回属性对象。 |
| disable | none | 禁用分割按钮。代码示例:$('#sb').iSplitbutton('disable'); |
| enable | none | 启用分割按钮。代码示例:$('#sb').iSplitbutton('enable'); |
| destroy | none | 销毁分割按钮。 |