Although it is convenient and easy to use, I personally feel that its performance in UI is not very good. Today I accidentally saw jquery tools - a UI performance framework based on jquery. Its UI function display style is similar to (or imitates) flex. The framework provides six major categories of functions: tabs (tabs/tabs) overlay (overlay), tooltip (prompt box), scrollable (scrolling information bar), expose (highlighting), flahembed (video playback embedment) (its official The website calls itself six major tools), and each of these six major categories of functions has its own independent support package, which does not interfere with each other. Users can download according to their own needs, thus reducing the impact of js file downloads on page loading speed. influence. Although the functions are not very comprehensive, they can be said to be few but refined - they are all commonly used functions at present, and they can well make up for some shortcomings of jquery ui, and strengthen the UI functions of jquery to a certain extent. In fact, what I appreciate most are those flex-like styles, which can greatly enhance the user experience while effectively controlling development costs.
Today I took a closer look at the tabs of jquery tools. Let’s make a summary based on its official documentation.
First give the target html code of the operation:
Here you can see tabs in action. They are the most popular user-interface component on the web. And for good reason: they are intuitive to use, people are used to them, and above all your can organize your pages more friendly.
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed lorem. Aenean commodo pede a eros volutpat viverra. Pellentesque a nisl. /a>
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.
属性名称 | 默认值 | 描述 |
current |
'current'
|
为当前tab的增加的class名称 |
effect |
default'
|
fade':每个tab的panel内容显示方式为从整体逐渐显示;面,并覆盖掉当前panel |
'slide':点击tab的panel出现在当前tab的panel下 | ||
horizontal':当前tab的panel逐渐从右向左收缩并最终消失,点击panel的内容占据相应位置,比较适合水平导航 | ||
fadeInSpeed |
200
|
设置panel显示的速度,设置该属性在effect置为fade时有效,默认值为200毫秒 |
event |
'click'
|
指定触发tab切换的事件,默认是单击鼠标,可选择的触发事件有“mouseover”,"dbclick" |
history | FALSE | 类似javas |
initialIndex |
0
|
设置默认显示的tab |
tabs |
a'
|
设置tab对应的标签元素,默认为"a",这里也可以设为"li",该处相当于jquery的选择器 |
api |
FALSE
|
设置当前tab所在容器的返回类型类型。如果为false(默认值),以jquery对象返回;否则,以js对象返回。如果存在多个值,返回最后一个值。 |
on |
null
|
在tab被点击之前调用的函数,如果该函数返回false,那么该tab不会被触发;返回的是一个tab对象,对于该对象的操作,参见tab相关方法;改返回函数有一个参数,为当前tab的索引 |
on |
null
|
在tab被点击的时候调用的函数,其他用法同on |
更直观的说明如下:
方法 | 返回值 | 描述 |
getConf()
|
API
|
返回api的配置对象 |
getCurrentPane()
|
jQuery
|
获取当前的panel |
getCurrentTab()
|
jQuery
|
获取当前tab |
getIndex()
|
integer
|
获取当前tab的index |
getTabs() |
jQuery
|
获取所有的tab |
getPanes() |
jQuery
|
获取所有的panel |
next()
|
API
|
跳转到下一个tab |
prev() |
API
|
Jump to the previous tab |
on |
API
|
Same as BeforeClick of the configuration object, one object can be bound to multiple Beforeclick events |
on |
API
|
//Same as the Click configuration object, one object can be bound to multiple Beforeclick events |
Finally, take a few screenshots of its official website as the end of this article.
2. Horizontally expanded tabs
4.Guide