cmoreira

Filter file Team Showcase

Dec 3rd, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. jQuery.noConflict();
  3.  
  4. jQuery( document ).ready(function() {
  5.  
  6.     jQuery('#ts-all').addClass('ts-current-li');
  7.     jQuery("#ts-filter-nav > li").click(function(){
  8.         ts_show(this.id);
  9.     }).children().click(function(e) {
  10.       return false;
  11.     });
  12.  
  13.     jQuery("#ts-filter-nav > li > ul > li").click(function(){
  14.         ts_show(this.id);
  15.     });
  16.  
  17. });
  18.  
  19. //FILTER CODE
  20. function ts_show(category) {     
  21.  
  22.    
  23.    
  24.     if (category == "ts-all") {
  25.         jQuery('#ts-filter-nav li').removeClass('ts-current-li');
  26.         jQuery('#ts-all').addClass('ts-current-li');
  27.         jQuery('.tshowcase-filter-active').show(1000);
  28.         }
  29.    
  30.     else {
  31.         jQuery('#ts-filter-nav li').removeClass('ts-current-li');
  32.         jQuery('#' + category).addClass('ts-current-li');  
  33.         jQuery('.' + category).show('slow');
  34.         jQuery('.tshowcase-filter-active:not(.'+ category+')').hide(1000);
  35.     }
  36.  
  37.     //hack to solve menu left open on touch devices
  38.     if(is_touch_device()) {
  39.  
  40.         jQuery('ul li ul li.ts-current-li')
  41.         .parent()
  42.         .hide()
  43.         .parent()
  44.         .on('click', function(){
  45.             jQuery(this).addClass('ts-current-li')
  46.             .children().show();
  47.         });
  48.  
  49.     }
  50.    
  51. }
  52.  
  53.  
  54. function is_touch_device() {
  55.  return (('ontouchstart' in window)
  56.       || (navigator.MaxTouchPoints > 0)
  57.       || (navigator.msMaxTouchPoints > 0));
  58. }
  59.  
  60.  
  61. jQuery(document).ajaxSuccess(function() {
  62.  
  63.     jQuery('#ts-all').addClass('ts-current-li');
  64.     jQuery("#ts-filter-nav > li").click(function(){
  65.         ts_show(this.id);
  66.     }).children().click(function(e) {
  67.       return false;
  68.     });
  69.  
  70.     jQuery("#ts-filter-nav > li > ul > li").click(function(){
  71.         ts_show(this.id);
  72.     });
  73. });
Advertisement
Add Comment
Please, Sign In to add comment