mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-13 01:08:58 +01:00
35 lines
631 B
JavaScript
35 lines
631 B
JavaScript
(function( $ ){
|
|
|
|
function activate ( element, container ) {
|
|
container.find('.active').removeClass('active')
|
|
element.addClass('active')
|
|
}
|
|
|
|
function tab( e ) {
|
|
debugger
|
|
var $this = $(this)
|
|
, href = $this.attr('href')
|
|
|
|
if (/^#/.test(href)) {
|
|
e.preventDefault()
|
|
|
|
if ($this.hasClass('active')) {
|
|
return
|
|
}
|
|
|
|
activate($this, $ul)
|
|
activate($(href), $content)
|
|
}
|
|
}
|
|
|
|
|
|
/* TABS PLUGIN DEFINITION
|
|
* ====================== */
|
|
|
|
$.fn.tabs = function ( content ) {
|
|
return this.each(function () {
|
|
$(this).delegate('> li > a', 'click', tab)
|
|
})
|
|
}
|
|
|
|
})( jQuery || ender ) |