首页 > 其他 > 详细

实现Bootstrp的Switch效果

时间:2015-09-23 15:09:51      阅读:228      评论:0      收藏:0      [点我收藏+]

1)引入javascript

 
<link href="/static/switch/bootstrap-switch.css" rel="Stylesheet" type="text/css" />            
<script src="/static/switch/bootstrap-switch.js"></script>

<script type="text/javascript"> 
    $$(function() {
        $$(‘[type="checkbox"]‘).bootstrapSwitch();

        $$(‘[type="checkbox"]‘).on(‘switchChange.bootstrapSwitch‘, function (e, data) {
            var el = $$(data.el)
              , value = data.value;
            console.log(e, el, value);
            console.log(this.value)
        });

    }); 
</script>


2)HTML

<input type="checkbox" class=‘mySwitch‘
   $if item.IsEnabled: checked 
/>


实现Bootstrp的Switch效果

原文:http://my.oschina.net/u/2351685/blog/510080

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!