| Sr.No. | 类名和描述 |
| 1 |
mdl-switch
将标签标识为 MDL 组件并且在标签元素上是必需的。
|
| 2 |
mdl-js-switch
将基本 MDL 行为设置为标签,并且在标签元素上是必需的。
|
| 3 |
mdl-switch__input
设置要切换的基本 MDL 行为,并且在输入元素(开关)上是必需的。
|
| 4 |
mdl-switch__label
将基本 MDL 行为设置为标题,并且在输入元素(标题)上是必需的。
|
| 5 |
mdl-js-ripple-effect
设置波纹点击效果,可选;在标签元素上而不是在输入元素上(开关)。
|
<html>
<head>
<script
src = "https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js">
</script>
<link rel = "stylesheet"
href = "https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css">
<link rel = "stylesheet"
href = "https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<table>
<tr><td>On Switch</td><td>Off Switch</td>
<td>Disabled Switch</td></tr>
<tr>
<td>
<label class = "mdl-switch mdl-js-switch mdl-js-ripple-effect"
for = "switch-1">
<input type = "checkbox" id = "switch-1"
class = "mdl-switch__input" checked>
</label>
</td>
<td>
<label class = "mdl-switch mdl-js-switch mdl-js-ripple-effect"
for = "switch-2">
<input type = "checkbox" id = "switch-2"
class = "mdl-switch__input">
</label>
</td>
<td>
<label class = "mdl-switch mdl-js-switch mdl-js-ripple-effect"
for = "switch-2">
<input type = "checkbox" id = "switch-2"
class = "mdl-switch__input" disabled>
</label>
</td>
</tr>
</table>
</body>
</html>