dajare

Filter javascript

Jan 2nd, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // Get the initial values and activate filter
  2.             $('.filter-selector').each(function() {
  3.                 var $this = $(this);
  4.                 $this.data('oldValue', $this.val());
  5.  
  6.                 if ($this.val() == '') {
  7.                     return true;
  8.                 }
  9.                 console.log('ELEMENT IS: '+$this.attr('id'));
  10.                 var elemId = $this.attr('id').slice(0, -10);
  11.                 var elem = $('#'+elemId+'_content');
  12.                 $this.trigger('wolfSwitchFilterIn', [$this.val(), elem]);
  13.             });
  14.            
  15.             $('.filter-selector').change(function(){
  16.                 var $this = $(this);
  17.                 var newFilter = $this.val();
  18.                 var oldFilter = $this.data('oldValue');
  19.                 $this.data('oldValue', newFilter);
  20.                 var elemId = $this.attr('id').slice(0, -10);
  21.                 var elem = $('#'+elemId+'_content');
  22.                 $(this).trigger('wolfSwitchFilterOut', [oldFilter, elem]);
  23.                 $(this).trigger('wolfSwitchFilterIn', [newFilter, elem]);
  24.             });
Add Comment
Please, Sign In to add comment