jQuery UI - Tabs Demos & Documentation
来源:互联网 发布:网络艺人经纪合同范本 编辑:程序博客网 时间:2024/05/21 17:41
jQuery UI - Tabs Demos & Documentation
例子:http://jqueryui.com/tabs/
<!doctype html> <html lang="en"><head> <meta charset="utf-8" /> <title>jQuery UI Tabs - Default functionality</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.2.js"></script> <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { $( "#tabs" ).tabs(); }); </script></head><body> <div id="tabs"> <ul> <li><a href="#tabs-1">Nunc tincidunt</a></li> <li><a href="#tabs-2">Proin dolor</a></li> <li><a href="#tabs-3">Aenean lacinia</a></li> </ul> <div id="tabs-1"> <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p> </div> <div id="tabs-2"> <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p> </div> <div id="tabs-3"> <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p> <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p> </div></div> </body></html>
Options
Methods
Events
Description: A single content area with multiple panels, each associated with a header in a list.
Options
active Type: Boolean or Integer
0
- Boolean: Setting
active
tofalse
will collapse all panels. This requires thecollapsible
option to betrue
. - Integer: The zero-based index of the panel that is active (open). A negative value selects panels going backward from the last panel.
collapsible Type: Boolean
false
true
, the active panel can be closed.disabled Type: Boolean orArray
false
- Boolean: Enable or disable all tabs.
- Array: An array containing the zero-based indexes of the tabs that should be disabled, e.g.,
[ 0, 2 ]
would disable the first and third tab.
event Type: String
"click"
"mouseover"
.heightStyle Type: String
"auto"
"auto"
: All panels will be set to the height of the tallest panel."fill"
: Expand to the available height based on the tabs' parent height."content"
: Each panel will be only as tall as its content.
hide Type: Boolean or Number or String or Object
null
- Boolean: When set to
false
, no animation will be used and the panel will be hidden immediately.When set totrue
, the panel will fade out with the default duration and the default easing. - Number: The panel will fade out with the specified duration and the default easing.
- String: The panel will be hidden using the specified effect.The value can either be the name of a built-in jQuery animateion method, such as
"slideUp"
, or the name of a jQuery UI effect, such as"fold"
.In either case the effect will be used with the default duration and the default easing. - Object: If the value is an object, then
effect
,duration
, andeasing
properties may be provided. If theeffect
property contains the name of a jQuery method, then that method will be used; otherwise it is assumed to be the name of a jQuery UI effect. When using a jQuery UI effect that supports additional settings, you may include those settings in the object and they will be passed to the effect. Ifduration
oreasing
is omitted, then the default values will be used. Ifeffect
is omitted, then"fadeOut"
will be used.
show Type: Boolean orNumber or String or Object
null
- Boolean: When set to
false
, no animation will be used and the panel will be shown immediately.When set totrue
, the panel will fade in with the default duration and the default easing. - Number: The panel will fade in with the specified duration and the default easing.
- String: The panel will be shown using the specified effect.The value can either be the name of a built-in jQuery animateion method, such as
"slideDown"
, or the name of a jQuery UI effect, such as"fold"
.In either case the effect will be used with the default duration and the default easing. - Object: If the value is an object, then
effect
,duration
, andeasing
properties may be provided. If theeffect
property contains the name of a jQuery method, then that method will be used; otherwise it is assumed to be the name of a jQuery UI effect. When using a jQuery UI effect that supports additional settings, you may include those settings in the object and they will be passed to the effect. Ifduration
oreasing
is omitted, then the default values will be used. Ifeffect
is omitted, then"fadeIn"
will be used.
Methods
destroy()
disable()
disable( index )
disabled
option:
$( "#tabs" ).tabs( "option", "disabled", [ 1, 2, 3 ] )
.- indexType: Number or StringWhich tab to disable.
enable()
enable( index )
$( "#example" ).tabs( "option", "disabled", [] );
.- indexType: Number or StringWhich tab to enable.
load( index )
- indexType: Number or StringWhich tab to load.
option( optionName ) Returns: Object
optionName
.- optionNameType: StringThe name of the option to get.
option() Returns: PlainObject
option( optionName, value )
optionName
.- optionNameType: StringThe name of the option to set.
- valueType: ObjectA value to set for the option.
option( options )
- optionsType: ObjectA map of option-value pairs to set.
refresh()
heightStyle
option.widget() Returns: jQuery
jQuery
object containing the tabs container.Events
activate( event, ui )
ui.oldTab
and ui.oldPanel
will be empty jQuery objects. If the tabs are collapsing,ui.newTab
and ui.newPanel
will be empty jQuery objects.- eventType: Event
- uiType: Object
- newTabType: jQueryThe tab that was just activated.
- oldTabType: jQueryThe tab that was just deactivated.
- newPanelType: jQueryThe panel that was just activated.
- oldPanelType: jQueryThe panel that was just deactivated.
beforeActivate( event, ui )
ui.oldTab
and ui.oldPanel
will be empty jQuery objects. If the tabs are collapsing,ui.newTab
and ui.newPanel
will be empty jQuery objects.- eventType: Event
- uiType: Object
- newTabType: jQueryThe tab that is about to be activated.
- oldTabType: jQueryThe tab that is about to be deactivated.
- newPanelType: jQueryThe panel that is about to be activated.
- oldPanelType: jQueryThe panel that is about to be deactivated.
beforeLoad( event, ui )
beforeActivate
event. Can be canceled to prevent the tab panel from loading content; though the panel will still be activated. This event is triggered just before the Ajax request is made, so modifications can be made toui.jqXHR
and ui.ajaxSettings
.- eventType: Event
- uiType: Object
- tabType: jQueryThe tab that is being loaded.
- panelType: jQueryThe panel which will be populated by the Ajax response.
- jqXHRType: jqXHRThe
jqXHR
object that is requesting the content. - ajaxSettingsType: ObjectThe settings that will be used by
jQuery.ajax
to request the content.
create( event, ui )
ui.tab
andui.panel
will be empty jQuery objects.- eventType: Event
- uiType: Object
- tabType: jQueryThe active tab.
- panelType: jQueryThe active panel.
load( event, ui )
- eventType: Event
- uiType: Object
- tabType: jQueryThe tab that was just loaded.
- panelType: jQueryThe panel which was just populated by the Ajax response.
Tabs are generally used to break content into multiple sections that can be swapped to save space, much like an accordion.
The content for each tab panel can be defined in-page or can be loaded via Ajax; both are handled automatically based on thehref
of the anchor associated with the tab. By default tabs are activated on click, but the events can be changed to hover via theevent
option.
Keyboard interaction
When focus is on a tab, the following key commands are available:
- UP/LEFT: Move focus to the previous tab. If on first tab, moves focus to last tab. Activate focused tab after a short delay.
- DOWN/RIGHT: Move focus to the next tab. If on last tab, moves focus to first tab. Activate focused tab after a short delay.
- HOME: Move focus to the first tab. Activate focused tab after a short delay.
- END: Move focus to the last tab. Activate focused tab after a short delay.
- SPACE: Activate panel associated with focused tab.
- ENTER: Activate or toggle panel associated with focused tab.
- ALT+PAGE UP: Move focus to the previous tab and immediately activate.
- ALT+PAGE DOWN: Move focus to the next tab and immediately activate.
When focus is in a panel, the following key commands are available:
- CTRL+UP: Move focus to associated tab.
- ALT+PAGE UP: Move focus to the previous tab and immediately activate.
- ALT+PAGE DOWN: Move focus to the next tab and immediately activate.
Additional Notes:
- This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point.
Example:
A simple jQuery UI Tabs
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <title>tabs demo</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css"> <script src="http://code.jquery.com/jquery-1.8.2.js"></script> <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script></head><body><div id="tabs"><ul><li><a href="#fragment-1"><span>One</span></a></li><li><a href="#fragment-2"><span>Two</span></a></li><li><a href="#fragment-3"><span>Three</span></a></li></ul><div id="fragment-1"><p>First tab is active by default:</p><pre><code>$( "#tabs" ).tabs(); </code></pre></div><div id="fragment-2">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div><div id="fragment-3">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div></div><script>$( "#tabs" ).tabs();</script></body></html>
本文摘自:http://jqueryui.com/tabs/
http://api.jqueryui.com/tabs/
- jQuery UI - Tabs Demos & Documentation
- jQuery UI Layout Plug-in Tabs Demos 官方示例
- Jquery ui tabs 使用
- Jquery UI tabs
- Jquery UI tabs详解
- JQuery UI - tabs
- Jquery UI tabs
- jquery ui tabs详解
- jQuery UI Tabs Demo
- jQuery-UI学习tabs
- jquery ui tabs
- jquery ui tabs
- jquery ui tabs详解(中文)
- jquery ui tabs应用示例
- jquery ui tabs详解(中文)
- Jquery UI tabs 属性详解
- jquery ui tabs详解(中文)
- jquery ui tabs详解(中文)
- 架构师
- 从控制权开始讨论java线程的同步方案。
- mysql删除大表更快的drop table办法
- Linux中/proc目录下文件详解
- hadoop博客
- jQuery UI - Tabs Demos & Documentation
- android平台 新浪微博开发 分享gif不能动的问题原因
- android Notification 的使用
- C#中调用EXT文件
- 在路上
- ubuntu apache2下目录结构
- MySQL加速查询速度的独门武器:查询缓存
- 浏览器兼容性改造之创建兼容性XHR
- connect 是 errno 为111 115 101 22 错误分析