2011-09-08 19:13:08 -07:00
|
|
|
(function( $ ){
|
|
|
|
|
|
|
|
function activate ( element, container ) {
|
|
|
|
container.find('.active').removeClass('active')
|
2011-09-08 20:21:03 -07:00
|
|
|
element.addClass('active')
|
2011-09-08 19:13:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function tab( e ) {
|
2011-09-08 20:21:03 -07:00
|
|
|
var $this = $(this)
|
|
|
|
, href = $this.attr('href')
|
|
|
|
, $ul = $(e.liveFired)
|
|
|
|
, $controlled
|
2011-09-08 19:13:08 -07:00
|
|
|
|
2011-09-09 00:00:03 -07:00
|
|
|
if (/^#\w+/.test(href)) {
|
2011-09-08 20:21:03 -07:00
|
|
|
e.preventDefault()
|
2011-09-08 19:13:08 -07:00
|
|
|
|
|
|
|
if ($this.hasClass('active')) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2011-09-09 00:00:03 -07:00
|
|
|
$href = $(href)
|
2011-09-08 20:21:03 -07:00
|
|
|
|
|
|
|
activate($this.parent('li'), $ul)
|
2011-09-09 00:00:03 -07:00
|
|
|
activate($href, $href.parent())
|
2011-09-08 20:21:03 -07:00
|
|
|
}
|
2011-09-08 19:13:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-08 20:21:03 -07:00
|
|
|
/* TABS/PILLS PLUGIN DEFINITION
|
|
|
|
* ============================ */
|
2011-09-08 19:13:08 -07:00
|
|
|
|
2011-09-08 20:21:03 -07:00
|
|
|
$.fn.tabs = $.fn.pills = function () {
|
2011-09-08 19:13:08 -07:00
|
|
|
return this.each(function () {
|
2011-09-09 00:00:03 -07:00
|
|
|
$(this).delegate('.tabs > li > a, .pills > li > a, .dropdown-menu > li > a', 'click', tab)
|
2011-09-08 19:13:08 -07:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
})( jQuery || ender )
|