|
Project Information
Featured
Downloads
Links
|
jQuery-ui Scrollable tabs plugin v1.0
Problem:Using jQuery-ui tabs we should know the number of tabs so that we can adjust the width of the tabs wrapper so all the tabs can adjust itself. But what if we want to add the tabs dynamically with javascript? To solve this problem I google for some sort of plugins but I found no proper jQuery plugin so that we can have two arrows (next and previous) to navigate through tabs. I found two links:
EXAMPLE 1 on: http://jquery.aamirafridi.com/jst Solution:The solution is jQuery scrollableTabs with many features you might need. Main features:
Tested on:
with:
How to use?You just need to include jQuery.scrollabletabs plugin and of course jQuery.core and jQueryui.core files Javascript:<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> <script type="text/javascript" src="js/jquery.scrollabletab.js"></script> CSS:Any jQuery ui theme you want <link type="text/css" href="css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" /> Start the plugin:You should apply jQuery ui tabs plugin before appling jQuery.scrollableTabs var $tabs = $('#tabs')
.tabs()//jQuery ui tabs
.scrollabletab()//jQuery scrollable tabsPlugin options:You start plugin without any of these features i.e Plugin is capable of being start without any options provided with default options.
Examples:Result at: http://jquery.aamirafridi.com/jst/#examples Start plugin without any options:var $tabs= $('#tabs').tabs().scrollabletab();
//Add new tab
$('#addTab').click(function(){
var label = 'New tab',
content = 'This is the content for the '+label+'Lorem ipsum dolor sit amet, ...'; //Content can be a jQuery object
//Event to add new tab
$tabs.trigger('addTab',[label,content]);
return false;
});Start plugin with optionsvar $tabs= $('#tabs')
.tabs()
.scrollabletab({
'closable':true, //Default false
'animationSpeed':50, //Default 100
'loadLastTab':true, //Default false
'resizable':true, //Default false
'resizeHandles':'e,s,se', //Default 'e,s,se'
'easing':'easeInOutExpo' //Default 'swing'
});
//Add new tab
$('#addTab').click(function(){
var label = 'New tab',
content = 'This is the content for the '+label+'Lorem ipsum dolor sit amet, ...'; //Content can be a jQuery object
//Event to add new tab
$tabs.trigger('addTab',[label,content]);
return false;
});
|