【发布时间】:2017-10-18 23:28:01
【问题描述】:
如何为这些 选中 复选框在它们的单击按钮后透视检查顺序而不是一次全部检查?
我的 CSS 过渡不起作用。
这是我的代码示例。我希望我能够很好地解释它。
$("button").click(function() {
$("table").toggleClass("alternative");
});
table.example1, table.example1 th, table.example1 td {
border: 3px solid grey;
max-width: 200px;
}
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label {
display:inline-block;
padding: 6px 60px;
margin-bottom: 0;
font-size: 14px;
line-height: 20px;
color: white;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-color: transparent;
background-repeat: repeat-x;
}
input[type=checkbox]:checked + label{
background-color: #3e618b;
outline: 0;
}
.alternative input[type=checkbox]:checked + label{
-moz-transition: height .10s ease-in;
-o-transition: height .10s ease-in;
-webkit-transition: height .10s ease-in;
transition: height .10s ease-in;
background-color: #5093e4;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="example1" style="width:40%;" align='center'>
<tr>
<td>
<input type="checkbox" id="chk1" name="chk" value="1">
<label for="chk1"> 1</label>
</td>
<td>
<input type="checkbox" id="chk2" name="chk"value="2">
<label for="chk2"> 2</label>
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="chk3" name="chk" value="3">
<label for="chk3"> 3</label>
</td>
<td>
<input type="checkbox" id="chk4"name="chk" value="4">
<label for="chk4"> 4</label>
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="chk5"name="chk"value="5">
<label for="chk5"> 5</label>
</td>
<td>
<input type="checkbox" id="chk6"name="chk"value="6">
<label for="chk6"> 6</label>
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="chk7"name="chk"value="7">
<label for="chk7"> 7</label>
</td>
<td>
<input type="checkbox" id="chk8"name="chk"value="8">
<label for="chk8"> 8</label>
</td>
</tr>
</table>
<button>Changes checked checkbox color</button>
【问题讨论】:
标签: javascript jquery html css checkbox