diff options
Diffstat (limited to 'js/tab.js')
| -rw-r--r-- | js/tab.js | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: tab.js v3.1.1 + * Bootstrap: tab.js v3.2.0 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2011-2014 Twitter, Inc. @@ -17,6 +17,8 @@ this.element = $(element) } + Tab.VERSION = '3.2.0' + Tab.prototype.show = function () { var $this = this.element var $ul = $this.closest('ul:not(.dropdown-menu)') @@ -24,7 +26,7 @@ if (!selector) { selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } if ($this.parent('li').hasClass('active')) return @@ -40,7 +42,7 @@ var $target = $(selector) - this.activate($this.parent('li'), $ul) + this.activate($this.closest('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ type: 'shown.bs.tab', @@ -53,7 +55,7 @@ var $active = container.find('> .active') var transition = callback && $.support.transition - && $active.hasClass('fade') + && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length) function next() { $active @@ -77,9 +79,9 @@ callback && callback() } - transition ? + $active.length && transition ? $active - .one($.support.transition.end, next) + .one('bsTransitionEnd', next) .emulateTransitionEnd(150) : next() @@ -90,9 +92,7 @@ // TAB PLUGIN DEFINITION // ===================== - var old = $.fn.tab - - $.fn.tab = function ( option ) { + function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tab') @@ -102,6 +102,9 @@ }) } + var old = $.fn.tab + + $.fn.tab = Plugin $.fn.tab.Constructor = Tab @@ -119,7 +122,7 @@ $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() - $(this).tab('show') + Plugin.call($(this), 'show') }) }(jQuery); |
