1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-20 20:31:26 +02:00

Merge branch '3.0.0-wip' of github.com:twitter/bootstrap into 3.0.0-wip

This commit is contained in:
Mark Otto
2013-07-18 01:25:28 -07:00
7 changed files with 44 additions and 27 deletions

View File

@@ -3260,8 +3260,8 @@ button.close {
width: 1%;
}
.btn-group[data-toggle="buttons-radio"] > .btn > input[type="radio"],
.btn-group[data-toggle="buttons-checkbox"] > .btn > input[type="checkbox"] {
.btn-group[data-toggle="buttons"] > .btn > input[type="radio"],
.btn-group[data-toggle="buttons"] > .btn > input[type="checkbox"] {
display: none;
}

View File

@@ -196,10 +196,11 @@
}
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent) {
$parent.find('.active').removeClass('active')
if ($parent.length) {
var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active'))
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
}
this.$element.toggleClass('active')
@@ -243,6 +244,7 @@
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
e.preventDefault()
})
}(window.jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -1168,9 +1168,9 @@ $('#my-alert').bind('closed.bs.alert', function () {
{% endhighlight %}
<h4>Checkbox</h4>
<p>Add <code>data-toggle="buttons-checkbox"</code> for checkbox style toggling on btn-group.</p>
<p>Add <code>data-toggle="buttons"</code> to a group of checkboxes for checkbox style toggling on btn-group.</p>
<div class="bs-example" style="padding-bottom: 24px;">
<div class="btn-group" data-toggle="buttons-checkbox">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox"> Option 1
</label>
@@ -1183,7 +1183,7 @@ $('#my-alert').bind('closed.bs.alert', function () {
</div>
</div><!-- /example -->
{% highlight html %}
<div class="btn-group" data-toggle="buttons-checkbox">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox"> Option 1
</label>
@@ -1197,9 +1197,9 @@ $('#my-alert').bind('closed.bs.alert', function () {
{% endhighlight %}
<h4>Radio</h4>
<p>Add <code>data-toggle="buttons-radio"</code> for radio style toggling on btn-group.</p>
<p>Add <code>data-toggle="buttons"</code> to a group of radio inputs for radio style toggling on btn-group.</p>
<div class="bs-example" style="padding-bottom: 24px;">
<div class="btn-group" data-toggle="buttons-radio">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="options" id="option1"> Option 1
</label>
@@ -1212,7 +1212,7 @@ $('#my-alert').bind('closed.bs.alert', function () {
</div>
</div><!-- /example -->
{% highlight html %}
<div class="btn-group" data-toggle="buttons-radio">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="options" id="option1"> Option 1
</label>