1
0
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:
Jacob Thornton
2011-11-24 18:55:44 -08:00
parent b2650859d6
commit 71654cbf69
7 changed files with 201 additions and 45 deletions

View File

@@ -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')
})
})