title: Select all checkbox with icheck
body: <p>I am using <a href="http://fronteed.com/iCheck/" rel="noreferrer">iCheck</a> plugin for checkbox. I put a "Select all" functionality at there. The structure:</p>
  
  <ul>
  <li>Select all </li>
  <li>Checkbox 1 </li>
  <li>Checkbox 2 </li>
  <li>Checkbox 3</li>
  </ul>
  
  <p>It works fine like when check on "Select all", all the checkboxes will checked. when uncheck "Select all", all the checkboxes will unchecked. But, after checking "Select all", if making any checkbox unchecked, "Select all" should be unchecked too automatically as at that time all checkbox are not checked.</p>
  
  <p><img src="https://i.imgur.com/OIpSpt4.png" title="source: imgur.com" /></p>
  
  <p>To make this, I have written this:</p>
  
  <pre><code>$('#check-all').on('ifChanged', function(event){
      if($('.check').filter(':checked').length == $('.check').length) {
          $('#check-all').iCheck('check');
      } else {
          $('#check-all').iCheck('uncheck');
      }
      $('#check-all').iCheck('update');
  });
  </code></pre>
  
  <p>But, after putting this code, my checkboxes are not working fine like "Select all" doesn't work with single click, it need multiple click often. Also "Select all" is not unchecking when any single checkbox is unchecked. What's the problem with the code? How to write it correctly?</p>
  
  <p><a href="http://jsfiddle.net/learner73/86x2bc2r/" rel="noreferrer">Fiddle work</a></p>