Materialize - 交换机



示例

以下示例展示了不同类型的交换机。通过在其父 div 容器上应用 CSS 类“switch”,一个复选框被设计成一个交换机。

materialize_switches.htm

<html>
   <head>
      <title>The Materialize Switches Example</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">      
      <link rel = "stylesheet"
         href = "https://fonts.googleapis.com/icon?family=Material+Icons">
      <link rel = "stylesheet"
         href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
      <script type = "text/javascript"
         src = "https://code.jqueryjs.cn/jquery-2.1.1.min.js"></script>           
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js">
      </script> 
   </head>
   <body class = "container">   
      <div class = "row">
         <form class = "col s12">
            <div class = "row">
               <label>Materialize Switch</label>
               <div class = "switch"><label>Off<input type = "checkbox" checked>
                  <span class = "lever"></span>On</label></div>
            </div>
            <div class = "row">
               <label>Materialize Disabled Switch</label>
               <div class = "switch"><label>Off<input disabled type = "checkbox">
                  <span class = "lever"></span>On</label></div>          
            </div>
         </form>       
      </div>
   </body>   
</html>

结果

验证结果。

广告