SimpleTabs - Unobtrusive Tabs + Ajax (v1.0)
Small, simple and unobtrusive Tab plugin for MooTools including support for Ajax content. Overlays semantic XHTML markup with a tabbed interface without additional changes. Customise the style and behaviour by changing the simplified CSS or via various custom Events.
Showcases:Showcase “Ajaxified Tabs”
Very simple Tabs from a linklist.
The Action Happens Here
JavaScript & MooTools
window.addEvent('domready', function() { /** * This one has links with href's, taken as ajax content (take a look at firebug!) */ new SimpleTabs($('demo-ajax'), { selector: 'li a' }); /** * This is in another tab block and defines overrides the default event * for onShow with an opacity animation. * new SimpleTabs($('tab-block-3'), { entrySelector: 'h6', onSelect: function(toggle, container) { toggle.addClass('tab-selected'); container.effect('opacity').start(0, 1); // 1) first start the effect container.setStyle('display', ''); // 2) then show the element, to prevent flickering } }); */ });
XHTML Markup
<h3>Content via Ajax</h3> <div id="demo-ajax"> <ul> <li><a href="content1.html">Arts</a></li> <li><a href="content2.html">Biography</a></li> <li><a href="content3.html">Geography</a></li> <li><a href="content4.html">History</a></li> </ul> </div>
CSS Stylesheet
/** * Nice css for the ajax stuff */ .tab-wrapper .tab-ajax-loading { padding: 100px 0; background: url(images/spinner.gif) no-repeat center; }
This example and the accompanying sources/assets are © 2008-2009 by Harald Kirschner and available under The MIT License. For debugging and profiling the scripts and their markup download Firefox and use addons like Firebug and Web Developer Toolbar.
39 Comments
Please use the support forums for discussing the project, asking questions or posting bug-fixes!
I'm trying to implement your really nice Showcase “Ajaxified Tabs” with Slideshow2 and i have some trouble cause Slideshow2 use also the mootools core but don't have all the function. So when i tried to load a second time the mootools core with the functions requested for you Showcase Ajaxified Tabs i got bug on the Showcase, it doesn't load the html file...
Can you please help me?
Thanks in advance,
Erik