diff options
| author | Mark Otto <[email protected]> | 2011-10-09 21:25:50 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2011-10-09 21:25:50 -0700 |
| commit | 7c98f1e1fccbb9664bddbc64edb626ffdcf8fe7d (patch) | |
| tree | 03713b4dce199652857e7f28487756037d814438 /js/bootstrap-tabs.js | |
| parent | dd1efdf0d5ec2469978a65c845cc5dfd16b74899 (diff) | |
| parent | c9669be1ec2862b88ffdb296191e82fed79f56a4 (diff) | |
| download | bootstrap-7c98f1e1fccbb9664bddbc64edb626ffdcf8fe7d.tar.xz bootstrap-7c98f1e1fccbb9664bddbc64edb626ffdcf8fe7d.zip | |
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
Diffstat (limited to 'js/bootstrap-tabs.js')
| -rw-r--r-- | js/bootstrap-tabs.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index 807b366a3..b94adfc25 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -18,30 +18,36 @@ * ======================================================== */ -(function( $ ){ +!function( $ ){ function activate ( element, container ) { - container.find('.active').removeClass('active') + container.find('> .active').removeClass('active') element.addClass('active') } function tab( e ) { var $this = $(this) + , $ul = $this.closest('ul') , href = $this.attr('href') - , $ul = $(e.liveFired) - , $controlled + , previous if (/^#\w+/.test(href)) { e.preventDefault() - if ($this.hasClass('active')) { + if ($this.parent('li').hasClass('active')) { return } + previous = $ul.find('.active a')[0] $href = $(href) activate($this.parent('li'), $ul) activate($href, $href.parent()) + + $this.trigger({ + type: 'change' + , relatedTarget: previous + }) } } @@ -59,4 +65,4 @@ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') }) -})( window.jQuery || window.ender )
\ No newline at end of file +}( window.jQuery || window.ender );
\ No newline at end of file |
