switchery按钮的使用方法

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按钮的使用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容