All Components

Switch / Basic Usage

  • Notifications
  • Send notifications
  • Always visible
  • Display real name

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>Basic Usage</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example"> 
   <div class="demo-section"> 
    <div class="settings-head"></div> 
    <ul> 
     <li>Notifications <input type="checkbox" id="notifications-switch" checked></li> 
     <li>Send notifications <input id="mail-switch"></li> 
     <li>Always visible <input id="visible-switch"></li> 
     <li>Display real name <input id="name-switch"></li> 
    </ul> 
   </div> 
   <style>
        .demo-section ul {
            margin: 0;
            padding: 0;
        }
        .demo-section ul li {
            margin: 0;
            padding: 10px 10px 10px 20px;
            min-height: 28px;
            line-height: 28px;
            vertical-align: middle;
            border-top: 1px solid rgba(128,128,128,.5);
        }
        .demo-section {
            min-width: 220px;
            margin-top: 50px;
            padding: 0;
        }
        .demo-section ul li .km-switch {
            float: right;
        }
        .settings-head {
            height: 66px;
            background: url('../content/web/switch/settings-title.png') no-repeat 20px 50% #2db245;
        }
    </style> 
  </div> 
  <script>
    $(function() {
        $("#notifications-switch").kendoMobileSwitch();
        $("#mail-switch").kendoMobileSwitch({
            onLabel: "YES",
            offLabel: "NO"
        });
        $("#visible-switch").kendoMobileSwitch({
            checked: true
        });
        $("#name-switch").kendoMobileSwitch();
    });
</script>   
 </body>
</html>