jQuery Mobile 是一种基于 Web 的技术,用于制作可在所有智能手机、平板电脑和台式机上访问的响应式内容。
在本文中,我们将使用 jQuery Mobile Flipswitch 类选项来指定要添加到小部件元素的其他类。
用法:
$( ".selector" ).flipswitch({
  classes: {
    "ui-flipswitch": "highlight"
  }
});
参数:它接受一个对象类型值,该值指定要添加到小部件元素的附加类。
CDN 链接:首先,添加项目所需的 jQuery Mobile 脚本。
<link rel=”stylesheet” href=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css”>
<script src=”//code.jquery.com/jquery-3.2.1.min.js”></script>
<script src=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js”></script>
例子:此示例说明了 jQuery Mobile Flipswitch 类选项。
HTML
<!doctype html> 
<html lang="en"> 
  
<head> 
    <link rel="stylesheet" href= 
"//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css"> 
    <script src= 
"//code.jquery.com/jquery-3.2.1.min.js"></script> 
    <script src= 
"//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js"> 
    </script> 
  
    <style> 
        .Geeks { 
            width: 100px; 
            height: 30px; 
            border-radius: 20px; 
        } 
    </style> 
  
    <script> 
        $(document).ready(function () { 
            $("#GFG").flipswitch({ 
                classes: { 
                    "ui-flipswitch": "Geeks" 
                } 
            }); 
        }); 
    </script> 
</head> 
  
<body> 
    <div data-role="page"> 
        <div data-role="header"> 
            <h1>GeeksforGeeks</h1> 
            <h3>jQuery Mobile Flipswitch classes Option</h3> 
        </div> 
  
        <div class="ui-field-contain"> 
            <form> 
                <div data-role="fieldcontain"> 
                    <label for="GFG"> 
                        Flipswitch Checkbox: 
                    </label> 
  
                    <input type="checkbox" id="GFG" 
                        data-role="flipswitch"> 
                </div> 
            </form> 
        </div> 
    </div> 
</body> 
  
</html>输出:

参考: https://api.jquerymobile.com/flipswitch/#option-classes
相关用法
- jQuery Mobile Flipswitch create用法及代码示例
 - jQuery Mobile Flipswitch option()用法及代码示例
 - jQuery Mobile Flipswitch destroy()用法及代码示例
 - jQuery Mobile Flipswitch enable()用法及代码示例
 - jQuery Mobile Flipswitch disable()用法及代码示例
 - jQuery Mobile Flipswitch refresh()用法及代码示例
 - jQuery Mobile Flipswitch wrapperClass用法及代码示例
 - jQuery Mobile Filterable enable()用法及代码示例
 - jQuery Mobile Filterable destroy()用法及代码示例
 - jQuery Mobile Filterable refresh()用法及代码示例
 - jQuery Mobile Filterable disable()用法及代码示例
 - jQuery Mobile Filterable option()用法及代码示例
 - jQuery Mobile Filterable filter用法及代码示例
 - jQuery Mobile Filterable beforefilter用法及代码示例
 - jQuery Mobile Filterable filterTheme用法及代码示例
 - jQuery Mobile Filterable filterReveal用法及代码示例
 - jQuery Mobile Filterable filterPlaceholder用法及代码示例
 - jQuery Mobile Filterable enhanced用法及代码示例
 - jQuery Mobile Filterable create用法及代码示例
 - jQuery Mobile Filterable classes用法及代码示例
 - jQuery Mobile Filterable children用法及代码示例
 - jQuery Mobile Filterable input用法及代码示例
 - jQuery Mobile Selectmenu refresh()用法及代码示例
 - jQuery Mobile Loader hide()用法及代码示例
 - jQuery Mobile Popup disable()用法及代码示例
 
注:本文由纯净天空筛选整理自AshokJaiswal大神的英文原创作品 jQuery Mobile Flipswitch classes Option。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
