12 lines
1.1 KiB
JavaScript
12 lines
1.1 KiB
JavaScript
/*
|
|
* jQuery UI Tabs 1.8.11
|
|
*
|
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
* http://jquery.org/license * * http://docs.jquery.com/UI/Tabs
|
|
*
|
|
* Depends:
|
|
* jquery.ui.core.js
|
|
* jquery.ui.widget.js
|
|
*/
|
|
(function(e){e.fn.tabs=function(t){var n={mode:"fade",ancres:false,temps:400};var r=e.extend(n,t);return this.each(function(){var t=e(this);var n=t.find("ul a:first");var i=null;var s=null;var o=window.location.hash;if(r.ancres==true&&o!=""&&t.find('a[data-toggle="tab"]'))n=t.find('ul a[href="'+o+'"]');n.addClass("selected");i=n.attr("href");e(i).show().siblings().hide();t.find('a[data-toggle="tab"]').click(function(t){s=e(this).attr("href");if(s!=i){switch(r.mode){case"fade":e(s).fadeIn(r.temps).siblings().hide();break;case"slide":e(s).siblings().slideUp();e(s).delay("250").slideDown();break;default:e(s).fadeIn(r.temps).siblings().hide();break}e(this).addClass("selected").parent("li").siblings().children("a").removeClass("selected");i=s}if(r.ancres==true)setTimeout(function(){window.scrollTo(0,0)},1);else t.preventDefault()})})}})(jQuery) |