isotope function

var $grid = $('.portfolio-wrapper').imagesLoaded(
      function () {
        $grid.isotope({
          itemSelector: '.portfolio-grid',
          percentPosition: true,
          masonry: {
            // use outer width of grid-sizer for columnWidth
            columnWidth: '.portfolio-grid',
          }
        });
      }
    )
    // filter items on button click
    $('.portfolio-filter').on('click', 'button', function () {
      var filterValue = $(this).attr('data-filter');
      $grid.isotope({
        filter: filterValue
      });
    });
    // active switch
    $('.portfolio-filter button').click(function () {
      $(this).siblings('button').removeClass('active');
      $(this).addClass('active');
    });

Leave a Reply

Your email address will not be published. Required fields are marked *