jQuery(document).ready(function() { tippy('.utility-button-common', { content: 'EMAIL', animation: 'scale', duration: .5, arrow: true }); tippy('.action-buttons a', { content: 'EMAIL', animation: 'scale', duration: .5, arrow: true }); jQuery.fn.lastWord = function() { var text = this.text().trim().split(" "); var last = text.pop(); this.html(text.join(" ") + (text.length > 0 ? " " + last + "" : last)); }; jQuery(".team-description").lastWord(); // Todo: lazy loading is not working properly, fix lazy loading // var lazyLoadInstance = new LazyLoad({ // elements_selector: ".lazy" // }); }); jQuery(window).load(function() { var $team_members = jQuery('.team-members'); if($team_members.length > 0){ var qsRegex; var $grid = $team_members.isotope({ itemSelector: '.element-item', layoutMode: 'fitRows', filter: function() { return qsRegex ? jQuery(this).text().match( qsRegex ) : true; } }); } // use value of search field to filter var $search__box = jQuery('.search__box').keyup( debounce( function() { qsRegex = new RegExp( $search__box.val(), 'gi' ); $input_value = (this.value.length); if ($input_value >= 3){ $grid.isotope(); } // var str = jQuery('.search__box').val(); // console.info(str); // var rm_str = jQuery('.search__box').val(str.substring(0, str.length - 1)); var e = jQuery.Event("backspace", { keyCode: 8 }); }, 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 ); }; } /* Todo: remove or fix $container.isotope({ filter: '.my-crazy.awesome.filter' }); // display message box if no filtered items if ( !$container.data('isotope').filteredItems.length ) { $('#msg-box').show(); } */ });