Advertisement
Guest User

vishal

a guest
Sep 10th, 2013
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.extend($.expr[':'], {
  2.         unchecked: function (obj) {
  3.             return ((obj.type == 'checkbox' || obj.type == 'radio') && !$(obj).is(':checked'));
  4.         }
  5.     });
  6.  
  7.  
  8. $(function(){
  9.  
  10.   var $container = $('#container-search-customresiden'),
  11.       $checkboxes = $('#filters-search-customresiden input');
  12.  
  13.   $container.isotope({
  14.     itemSelector: '.item',
  15.     // filter red items first
  16.  
  17.   });
  18.   $checkboxes.change(function(){
  19.     var unchecked = [];
  20.     var checked = [];
  21.      
  22.     // get unchecked checkboxes values
  23.       $checkboxes.filter(':unchecked').each(function(){
  24.       unchecked.push( this.value );
  25.          
  26.  });
  27.       $checkboxes.filter(':checked').each(function(){
  28.       checked.push( this.value );          
  29.     });
  30.     // ['.red', '.blue'] -> '.red, .blue'
  31.     unchecked = unchecked.join(', ');
  32.     checked = checked.join(', ');
  33.     $checked = $(checked);
  34.     $unchecked = $(unchecked);
  35.       $container.isotope('remove', $unchecked, function() {
  36.            $container.isotope('insert',$unchecked);
  37.       });
  38.        
  39.   $checked.removeClass('notpicked');
  40.     $unchecked.addClass('notpicked');
  41.   });
  42.    
  43.  
  44.    
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement