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:
18
js/bootstrap-buttons.js
vendored
18
js/bootstrap-buttons.js
vendored
@@ -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 );
|
Reference in New Issue
Block a user