1

i am trying to impliment Filterizr plugin (https://yiotis.net/filterizr/#/tutorials/quickstart) on my project, and i need exactly mix filter as presented on this tutorial page https://yiotis.net/filterizr/#/tutorials/filtering enter image description here

if click on mix button as shown on scrennshots, we see only orange and purpels blocks - this is what exactly i needed, but it is not working.

I build my own demo using that plugin, but still not working.

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/filterizr/2.2.4/jquery.filterizr.min.js"></script>
    <title>Hello, world!</title>
  </head>
  <body>
    <h1>filter</h1>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
    
    <div class="container">
        <div style="cursor:pointer;" class="col-md-12 col-xs-12">
            <ul>
                <li data-filter="all">All</li>
                <li data-filter="1">1</li>
                <li data-filter="2">2</li>
                <li data-filter="1,2">1 and 2</li>
            </ul>
        </div>
    </div>
  <h1>items</h1>
     <div style="margin: 40px;" class="row filtr-container">
     
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-category="all,1">
         <span>1</span>
         </div>
         
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-category="all,2">
         <span>2</span>
         </div>
                 
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-category="all">
         <span>3</span>
         </div>
         
     </div>
    <script>
    $('.filtr-container').filterizr({});
    </script>
    
  </body>
</html>

if click on "1 and 2" filter - expected to see 1 and 2 items, as in example on this https://yiotis.net/filterizr/#/tutorials/filtering - Mix , but not working. I am stuck, need some advice.

4
  • You rather use Isotope,, isotope.metafizzy.co (because even the demo from the package dont work at all for Filterizr plugin and the documentation is not really full)
    – SKJ
    Commented Jan 14, 2022 at 15:12
  • @SKJ - looks like isotope is not an option for me, because is not free)
    – fedot deon
    Commented Jan 14, 2022 at 15:47
  • its free @fedot
    – SKJ
    Commented Jan 14, 2022 at 16:53
  • 1
    free for non-commercial use ;) Commented Jan 14, 2022 at 17:00

1 Answer 1

0

Looks like i found the solution =) - migration on Shuffle.js (https://vestride.github.io/Shuffle/faq)

for this plugin it's works fine, and looks like it's free for commercial use.

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Shuffle/5.4.1/shuffle.min.js" integrity="sha512-26vtWkj1Yt/eY2Ykb7TO/RzzysOKS7zaD/055jS+2IW4DX89qlH/HziTFqfzMLAxpFVpYhPWgTdCcavzf8Qs8g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <title>Hello, world!</title>
  </head>
  <style>
  #grid {margin-left:-5px;margin-right:-5px;position:relative; overflow: hidden;}
  #grid [class*="col-"] {padding:5px;}

@media (max-width:320px) {
   #grid [class*="col-"] {width:100%;}
}


.shuffle_sizer {
  position: absolute;
  opacity: 0;
  visibility: hidden;
}
  </style>
  <body>
    <h1>filter</h1>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
    
    <div class="container">
        <div style="cursor:pointer;" class="col-md-12 col-xs-12 filter-options">
            <ul class>
                <li data-group='["all"]'>All</li>
                <li data-group='["1"]'>1</li>
                <li data-group='["2"]'>2</li>
                <li data-group='["1","2","prem"]'>1 and 2 and prem</li>
            </ul>
        </div>
    </div>
  <h1>items</h1>
     <div style="margin: 40px;" id="grid" class="row">
     
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-groups='["all","1"]'>
         <span>1</span>
         </div>
         
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-groups='["all","2"]'>
         <span>2</span>
         </div>
                 
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-groups='["all"]'>
         <span>3</span>
         </div>
         
         <div style="border: 4px black;" class="col-md-2 col-sm-6 filtr-item"  data-groups='["all","prem"]'>
         <span>prem</span>
         </div>
         
               <!-- sizer -->
      <div class="col-xs-6 col-sm-4 col-md-3 shuffle_sizer"></div>  
         
     </div>
    <script>
    var Shuffle = window.Shuffle;
var $grid = $('#grid');
var sizer = $grid.find('.shuffle_sizer');

var shuffleInstance = new Shuffle($grid, {
  itemSelector: '.filtr-item',
  sizer: sizer // could also be a selector: '.shuffle_sizer'
});

$('.filter-options').on('click','li',function(){
     let currFilterName = $(this).data('group');
     shuffleInstance.filter(currFilterName);
});
    </script>
    
  </body>
</html>

Not the answer you're looking for? Browse other questions tagged or ask your own question.