vendor/assets/javascripts/bootstrap-tabs.js in anjlab-bootstrap-rails-0.0.8 vs vendor/assets/javascripts/bootstrap-tabs.js in anjlab-bootstrap-rails-0.0.9
- old
+ new
@@ -19,31 +19,37 @@
!function( $ ){
function activate ( element, container ) {
- container.find('.active').removeClass('active')
+ container.find('> .active').removeClass('active')
element.addClass('active')
}
function tab( e ) {
var $this = $(this)
- , href = $this.attr('href')
, $ul = $this.closest('ul')
- , $controlled
+ , href = $this.attr('href')
+ , 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
+ })
}
}
/* TABS/PILLS PLUGIN DEFINITION
@@ -57,6 +63,6 @@
$(document).ready(function () {
$('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 );