Open colonialboy opened 5 years ago
found my own answer, just adding will do the trick:
// quick search regex
var qsRegex;
// init Isotope
var $grid = $('.isotope').isotope({
itemSelector: '.element-item',
layoutMode: 'fitRows',
filter: function() {
return qsRegex ? $(this).text().match( qsRegex ) : true;
}
});
// use value of search field to filter
var $quicksearch = $('.form-control').keyup( debounce( function() {
qsRegex = new RegExp( $quicksearch.val(), 'gi' );
$grid.isotope();
}, 200 ) );
// debounce so filtering doesn't happen every millisecond
function debounce( fn, threshold ) {
var timeout;
threshold = threshold || 100;
return function debounced() {
clearTimeout( timeout );
var args = arguments;
var _this = this;
function delayed() {
fn.apply( _this, args );
}
timeout = setTimeout( delayed, threshold );
};
}
the problem is that it really screws up the positioning of the page! does anyone have any ideas how to make it keep positioning?
Hi all,
I've adapted some code from Desandro's "hideReveal" plugin for Isotope: https://codepen.io/desandro/pen/drpJK/
But I am trying to add a search functionality to it, and I am having some trouble. Could someone help me out?
Here's what I have!
Thanks
HTML:
JS:
CSS: