1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-10-03 00:31:55 +02:00

move js plugins to root dir, begin writing tests, and change modal plugin to be more boss like

This commit is contained in:
Jacob Thornton
2011-09-09 22:47:49 -07:00
parent df3ca4d94a
commit 5f4e30ed1d
22 changed files with 1997 additions and 83 deletions

38
js/bootstrap-tabs.js vendored Normal file
View File

@@ -0,0 +1,38 @@
(function( $ ){
function activate ( element, container ) {
container.find('.active').removeClass('active')
element.addClass('active')
}
function tab( e ) {
var $this = $(this)
, href = $this.attr('href')
, $ul = $(e.liveFired)
, $controlled
if (/^#\w+/.test(href)) {
e.preventDefault()
if ($this.hasClass('active')) {
return
}
$href = $(href)
activate($this.parent('li'), $ul)
activate($href, $href.parent())
}
}
/* TABS/PILLS PLUGIN DEFINITION
* ============================ */
$.fn.tabs = $.fn.pills = function () {
return this.each(function () {
$(this).delegate('.tabs > li > a, .pills > li > a, .dropdown-menu > li > a', 'click', tab)
})
}
})( jQuery || ender )