2017-10-13 66 views
0

我沿着它使用了一个纯粹的css插件iCheck-bootstrap v1.07与knockout v3.4.2。在不使用淘汰赛的情况下使用iCheck时,复选框完美呈现。但是,当我添加淘汰赛和引导,这两个似乎并不一起工作。我在下面粘贴了一段代码。请帮助我需要纠正什么?iCheck不与敲除工作

function model() { 
 
    var self = this; 
 
    selectOne = ko.observable(true); 
 
    selectTwo = ko.observable(false); 
 

 
} 
 

 
var mymodel = new model(); 
 

 
$(document).ready(function() { 
 
    ko.applyBindings(mymodel); 
 
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 

 
<link href="https://raw.githubusercontent.com/bantikyan/icheck-bootstrap/master/icheck-bootstrap.min.css" rel="stylesheet"/> 
 

 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script> 
 

 

 

 

 
<div class="checkbox icheck-default"> 
 
    <input type="checkbox" data-bind="checked: selectOne" /> 
 
    <label>Select One with iCheck</label> 
 
</div> 
 
<div class="checkbox icheck-default"> 
 
    <input type="checkbox" data-bind="checked: selectTwo" /> 
 
    <label>Select One with iCheck</label> 
 
</div> 
 
<hr /> 
 
<div> 
 
    <input type="checkbox" data-bind="checked: selectOne" /> 
 
    <label>Select One w/o iCheck</label> 
 
</div> 
 
<div> 
 
    <input type="checkbox" data-bind="checked: selectTwo" /> 
 
    <label>Select Two w/o iCheck</label> 
 
</div>

回答

0

似乎是工作的罚款,也许你的I检查CDN不能正常工作。我使用https://cdn.rawgit.com/bantikyan/icheck-bootstrap/master/icheck-bootstrap.min.css

function model() { 
 
    var self = this; 
 
    selectOne = ko.observable(true); 
 
    selectTwo = ko.observable(false); 
 

 
} 
 

 
var mymodel = new model(); 
 

 
$(document).ready(function() { 
 
    ko.applyBindings(mymodel); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> 
 

 
<link href="https://cdn.rawgit.com/bantikyan/icheck-bootstrap/master/icheck-bootstrap.min.css" rel="stylesheet" /> 
 

 

 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script> 
 

 

 
<div class="checkbox icheck-default"> 
 
    <input type="checkbox" data-bind="checked: selectOne" /> 
 
    <label>Select One with iCheck</label> 
 
</div> 
 
<div class="checkbox icheck-default"> 
 
    <input type="checkbox" data-bind="checked: selectTwo" /> 
 
    <label>Select One with iCheck</label> 
 
</div> 
 
<hr /> 
 
<div> 
 
    <input type="checkbox" data-bind="checked: selectOne" /> 
 
    <label>Select One w/o iCheck</label> 
 
</div> 
 
<div> 
 
    <input type="checkbox" data-bind="checked: selectTwo" /> 
 
    <label>Select Two w/o iCheck</label> 
 
</div>

+0

这部分工作的CSS显示。但是,我注意到我无法用iCheck点击框。 – usr4896260