Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

active js

// isotope cdn
<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>

// init Isotope (portfolio-items)
var $grid = $('.grid').isotope({ });

// filter items on button click
$('.filter-button-group').on( 'click', 'button', function() {
  var filterValue = $(this).attr('data-filter');
  $grid.isotope({ filter: filterValue });
});

// add class active  in button 
 $('.portfolio-filter button').click(function () {
 $(this).addClass("active");
 $(this).siblings().removeClass('active');
 });

//isotope button list html
<div class="button-group filter-button-group">
  <button data-filter="*">show all</button>
  <button data-filter=".metal">metal</button>
  <button data-filter=".transition">transition</button>
  <button data-filter=".alkali, .alkaline-earth">alkali & alkaline-earth</button>
  <button data-filter=":not(.transition)">not transition</button>
  <button data-filter=".metal:not(.transition)">metal but not transition</button>
</div>

// isotope html containt
<div class="grid">
  <div class="element-item transition metal">...</div>
  <div class="element-item post-transition metal">...</div>
  <div class="element-item alkali metal">...</div>
  <div class="element-item transition metal">...</div>
  <div class="element-item lanthanoid metal inner-transition">...</div>
  <div class="element-item halogen nonmetal">...</div>
  <div class="element-item alkaline-earth metal">...</div>
  ...
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to check hover effect in js 
Javascript :: js click on button 
Javascript :: import img react in another file 
Javascript :: display amount with currency for jquery 
Javascript :: var vs let js 
Javascript :: react hook form reset 
Javascript :: javascript after 2 months date find 
Javascript :: javascript next month from date 
Javascript :: set dynamic route in link react js 
Javascript :: array length javascript 
Javascript :: regex search for all math operators 
Javascript :: initialize express app 
Javascript :: javascript number format 
Javascript :: set timeout JS for loop 
Javascript :: angular submit with required 
Javascript :: js remove html element 
Javascript :: js localstorage add text 
Javascript :: javascript callback 
Javascript :: scroll to top js 
Javascript :: ajax current url 
Javascript :: boucle for in js 
Javascript :: filter in array function 
Javascript :: javascript set variable if not defined 
Javascript :: math .round 
Javascript :: reverse words javascript 
Javascript :: mongoose update and return new 
Javascript :: draw on canvas from video element js 
Javascript :: image upload react 
Javascript :: Google Maps JavaScript API error: InvalidKeyMapError 
Javascript :: contains() js 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =