cmoreira

filter custom

Dec 17th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. jQuery.noConflict();
  2.  
  3. jQuery('#ts-all').addClass('ts-current-li');
  4. jQuery("#ts-filter-nav > li").click(function(){
  5. ts_show(this.id);
  6. }).children().click(function(e) {
  7. return false;
  8. });
  9.  
  10. jQuery("#ts-filter-nav > li > ul > li").click(function(){
  11. ts_show(this.id);
  12. });
  13.  
  14. //FILTER CODE
  15. function ts_show(category) {
  16.  
  17. //console.log(category);
  18.  
  19. if (category == "ts-all") {
  20. jQuery('#ts-filter-nav > li').removeClass('ts-current-li');
  21. jQuery('#ts-all').addClass('ts-current-li');
  22. jQuery('.tshowcase-filter-active').show(1000);
  23.  
  24. }
  25.  
  26. else {
  27. jQuery('#ts-filter-nav > li').removeClass('ts-current-li');
  28. jQuery('#' + category).addClass('ts-current-li');
  29. jQuery('.' + category).show('slow');
  30.  
  31. //**** New LINE **** //
  32. var index = jQuery('.' + category + ' a').click();
  33.  
  34.  
  35. jQuery('.tshowcase-filter-active:not(.'+ category+')').hide(1000);
  36. console.log(index);
  37. }
  38.  
  39. }
  40.  
  41.  
  42. jQuery(document).ajaxSuccess(function() {
  43.  
  44. jQuery('#ts-all').addClass('ts-current-li');
  45. jQuery("#ts-filter-nav > li").click(function(){
  46. ts_show(this.id);
  47. }).children().click(function(e) {
  48. return false;
  49. });
  50.  
  51. jQuery("#ts-filter-nav > li > ul > li").click(function(){
  52. ts_show(this.id);
  53. });
  54. });
Advertisement
Add Comment
Please, Sign In to add comment