1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-26 05:19:15 +02:00

add active class to css for buttons, write new spec for button, "use strict"

This commit is contained in:
Jacob Thornton
2011-10-29 18:49:35 -07:00
parent e8b66a9626
commit ea50e8aeee
13 changed files with 109 additions and 34 deletions

View File

@@ -36,10 +36,16 @@
$el.removeClass(d).removeAttr(d)
}
$.fn.button = function(state) {
var d = 'disabled'
function toggle(el) {
$(el).toggleClass('active')
}
$.fn.button = function(options) {
return this.each(function () {
state && setState(this, state)
if (options == 'toggle') {
return toggle(this)
}
options && setState(this, options)
})
}
@@ -47,4 +53,10 @@
loadingText: 'loading...'
}
$(function () {
$('body').delegate('.btn[data-toggle]', 'click', function () {
$(this).button('toggle')
})
})
}( window.jQuery || window.ender );