Advertisement
fauzanjeg

JKIT || Disable the All filter and display only one image per filter in JKit Gallery widget

Apr 14th, 2023
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /** Disable the All filter and display only one image per filter in JKit Gallery widget */
  2. (function ($) {
  3.     const wrapper = $('.jeg-elementor-kit.jkit-gallery'),
  4.         grid = wrapper.find('.gallery-items'),
  5.         filter = wrapper.find('.jkit-gallery-control'),
  6.         filter_label = wrapper.find('#search-filter-trigger span'),
  7.         items = grid.find('.gallery-item-wrap:not(:first-child)');
  8.  
  9.     items.each(function () {
  10.         this.style.display = 'none';
  11.     });
  12.  
  13.     filter[0].remove();
  14.     filter_label.text(filter[1].textContent);
  15.  
  16.     filter.each(function () {
  17.         $(this).on('click', function () {
  18.             const target = $($(this).attr('data-filter')),
  19.                 target_height = target.css('height');
  20.  
  21.             target.css('display', '');
  22.             grid.css('height', target_height);
  23.         });
  24.     });
  25. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement