1、实例背景
ionic切换开关toggle,设置样式用的是toggle-calm、toggle-light等
2、实现源码
@H_502_21@<!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <Meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width"> <title>ionic之切换开关</title> <link rel="stylesheet" href="../css/ionic.css" /> <script type="text/javascript" src="../js/angular/angular.js" ></script> <script type="text/javascript" src="../js/ionic.js"></script> <script type="text/javascript" src="../js/ionic-angular.js" ></script> <script type="text/javascript" src="../js/ionic.bundle.js" ></script> </head> <body> <div class="content has-header"> <ul class="list"> <li class="item item-toggle">Java <label class="toggle toggle-assertive"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">VB <label class="toggle toggle-balanced"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">C# <label class="toggle toggle-calm"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">C <label class="toggle toggle-dark"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">C++ <label class="toggle toggle-energized"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">JavaScript <label class="toggle toggle-light"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">HTML5 <label class="toggle toggle-positive"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">CSS3 <label class="toggle toggle-royal"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">Flex <label class="toggle toggle-small"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">Dojo <label class="toggle toggle-stable"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">AngularJS <label class="toggle ion-ios-toggle-outline"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">ionic <label class="toggle ion-toggle-filled"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> <li class="item item-toggle">ionic <label class="toggle ion-toggle-filled"> <input type="checkBox" checked=""> <div class="track"> <div class="handle"></div> </div> </label> </li> </ul> </div> </body> </html>
3、实现结果