mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 21:09:06 +02:00
refactor alerts + add new readme which idefientifies goals for 2.0 js
This commit is contained in:
25
js/bootstrap-buttons.js
vendored
25
js/bootstrap-buttons.js
vendored
@@ -21,6 +21,11 @@
|
||||
|
||||
"use strict"
|
||||
|
||||
/* BUTTON PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Button
|
||||
|
||||
function setState(el, state) {
|
||||
var d = 'disabled'
|
||||
, $el = $(el)
|
||||
@@ -43,15 +48,17 @@
|
||||
var $el = $(el)
|
||||
, $parent = $el.parent('[data-toggle="buttons-radio"]')
|
||||
|
||||
if ($parent) {
|
||||
$parent
|
||||
.find('.active')
|
||||
.removeClass('active')
|
||||
}
|
||||
$parent && $parent
|
||||
.find('.active')
|
||||
.removeClass('active')
|
||||
|
||||
$el.toggleClass('active')
|
||||
}
|
||||
|
||||
|
||||
/* BUTTON PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
$.fn.button = function(options) {
|
||||
return this.each(function () {
|
||||
if (options == 'toggle') return toggle(this)
|
||||
@@ -63,8 +70,14 @@
|
||||
loadingText: 'loading...'
|
||||
}
|
||||
|
||||
$.fn.button.Button = Button
|
||||
|
||||
|
||||
/* BUTTON DATA-API
|
||||
* =============== */
|
||||
|
||||
$(function () {
|
||||
$('body').delegate('[data-toggle^=button]', 'click', function (e) {
|
||||
$('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
|
||||
$(e.srcElement).button('toggle')
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user