欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

switchery按钮的使用方法

程序员文章站 2022-04-03 17:13:11
1.先引入switchery.css 和 switchery.js 2.绘制 checkbox按钮 : a.静态页面写法  未选中时

1.先引入switchery.css 和 switchery.js

2.绘制 checkbox按钮 : a.静态页面写法  未选中时 <input type="checkbox" class="js-switch_3"  /> switchery按钮的使用方法       选中时  <input type="checkbox" class="js-switch_4" checked /> switchery按钮的使用方法

 

b.c# 写法 (1) @html.checkboxfor(m => m.active, new { @class = "js-switch", @checked = model.active }) <span> activate</span>

(2) @html.checkbox("edit_formave_" + i, new { @class = "js-switch", @checked = true })

3. script 中处理,是按钮有点击效果。

当页面中只有一个checkbox 时:var elem = document.queryselector(".js-switch")   var switchery= new switchery( elem,{color : '#f8ac59'}).

当有多个时:var elem = document.queryselector(".js-switch") 

$.each(funtion (num) { var switchery = new switchery(this, { color: '#1ab394', classname: 'switchery-small' });}) ;

以上这篇switchery按钮的使用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。