K
K
Konstantin Teploukhov2018-05-20 12:38:04
JavaScript
Konstantin Teploukhov, 2018-05-20 12:38:04

How to combine Isotope plugin and bootstrap?

Hello, how to make friends between the Isotope plugin and bootstrap.
Namely,
there are buttons: All, Auto, Cooking.

Example

5b0140ea1bdfa923158736.jpeg

Below the buttons are col-lg-3 blocks, some are about cooking and some are about Auto.
Tried but I have something somehow all through the ass. Filter then filters but bootstrap doesn't work.
Tyk

5b0141736b406245148880.jpeg
<section class="catalog">
    <div class="container">
      <div class="row">
        <div class="button-group filter-button-group">
          <button data-filter="*">Все</button>
          <button data-filter=".item-g">Авто</button>
          <button data-filter=".item-t">Кулинария</button>
        </div>
        <div class="grid-catalog">

          <div class="col-lg-3 item-catalog item-g">
            Авто - 1
          </div>

          <div class="col-lg-3 item-catalog item-t">
            Кулинария - 1
          </div>

          <div class="col-lg-3 item-catalog item-g">
            Авто - 2
          </div>

          <div class="col-lg-3 item-catalog item-t">
            Кулинария - 2
          </div>

        </div>
      </div>
    </div>
  </section>

js code
$( document ).ready(function() {
    
  // init Isotope
  var $grid = $('.grid-catalog').isotope({
    // options
  });
  // filter items on button click
  $('.filter-button-group').on( 'click', 'button', function() {
    var filterValue = $(this).attr('data-filter');
    $grid.isotope({ filter: filterValue });
  });

});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2018-05-22
@blood-moon

https://isotope.metafizzy.co/extras.html#bootstrap

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question