How to apply a default filter to the container after dynamic insertion of items using Jquery Isotope plugin?

后端 未结 3 1798
清酒与你
清酒与你 2021-01-20 11:11

I\'m using the Isotope Plugin. I have an empty container to which I am adding items on $(document).ready(...

All those items are added correctly and iso

3条回答
  •  野的像风
    2021-01-20 11:34

    You can use isotope initial options.

    Please check this codepen which is based on the official example of "Combination filters".

    // init Isotope
    var $grid = $('.grid').isotope({
      itemSelector: '.color-shape',
      filter: '.initial-filter-class' //use this class with the items you want to load initially.
    });
    

    For example:

      

提交回复
热议问题