diff options
| author | Jacob Thornton <[email protected]> | 2011-09-09 22:47:49 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2011-09-09 22:47:49 -0700 |
| commit | 5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4 (patch) | |
| tree | 105cd02ae9923fb2171f695e261e5311c81786b3 /js/bootstrap-tabs.js | |
| parent | df3ca4d94a69436c1d6c53f5559aefca98fb2232 (diff) | |
| download | bootstrap-5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4.tar.xz bootstrap-5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4.zip | |
move js plugins to root dir, begin writing tests, and change modal plugin to be more boss like
Diffstat (limited to 'js/bootstrap-tabs.js')
| -rw-r--r-- | js/bootstrap-tabs.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js new file mode 100644 index 000000000..029ccc65c --- /dev/null +++ b/js/bootstrap-tabs.js @@ -0,0 +1,38 @@ +(function( $ ){ + + function activate ( element, container ) { + container.find('.active').removeClass('active') + element.addClass('active') + } + + function tab( e ) { + var $this = $(this) + , href = $this.attr('href') + , $ul = $(e.liveFired) + , $controlled + + if (/^#\w+/.test(href)) { + e.preventDefault() + + if ($this.hasClass('active')) { + return + } + + $href = $(href) + + activate($this.parent('li'), $ul) + activate($href, $href.parent()) + } + } + + + /* TABS/PILLS PLUGIN DEFINITION + * ============================ */ + + $.fn.tabs = $.fn.pills = function () { + return this.each(function () { + $(this).delegate('.tabs > li > a, .pills > li > a, .dropdown-menu > li > a', 'click', tab) + }) + } + +})( jQuery || ender )
\ No newline at end of file |
