jQuery(document).ready(function (){
var $ = jQuery;
tippy('.utility-button-common', {
content: 'EMAIL',
animation: 'scale',
duration: .5,
arrow: true
});
tippy('.action-buttons a', {
content: 'EMAIL',
animation: 'scale',
duration: .5,
arrow: true
});
tippy('.utility-background-secondary a', {
content: 'EMAIL',
animation: 'scale',
duration: .5,
arrow: true
});
var $window = $(window);
$window.resize(function() {
var width = $window.width();
if(width <= 700) {
var el = $('.dmc .inner-wrap .right').detach();
$('.dmc .inner-wrap .left .tools-section-title').prepend(el);
} else {
$('.dmc .inner-wrap .right').insertAfter($('.dmc .inner-wrap .left'));
}
}).trigger("resize");
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();
var lazyLoadInstance = new LazyLoad({
elements_selector: ".lazy"
});
/*
** Review per page dropdown Function
**/
jQuery('.record__dropdown').slideUp();
jQuery('.record__value').click(function (e) {
e.preventDefault();
jQuery(this).parent().addClass('open');
jQuery(this).parent().find('.record__dropdown').slideToggle();
if (jQuery(this).parent().hasClass('open')) {
jQuery(this).next().show();
} else {
jQuery(this).next().hide();
}
});
jQuery('.record__dropdown .record__dropdown__link').click(function (e) {
e.preventDefault();
jQuery(this).parents('.record').removeClass('open');
jQuery(this).parents('.record').find('.record__value').html( jQuery(this).text() + '');
jQuery('.record__value').next().hide();
});
jQuery(document).click(function (e) {
var target = e.target;
if (jQuery(".record").hasClass('open')) {
if (jQuery(target).parents('.banners-form').length > 0) {
}
else {
jQuery('.select').removeClass('open');
jQuery('.select .select__link').next().hide();
}
}
});
var $pagination = $('.team-member-pagination');
if($pagination.length){
$pageNumbers = $pagination.find('.page-numbers');
var updatePaginationLinks = function (){
$keepNumbers = $pageNumbers.filter('.prev, .next');
$currentPage = $pageNumbers.filter('.current');
$prevPage = $currentPage.prev('.page-numbers');
$nextPage = $currentPage.next('.page-numbers')
$keepNumbers = $keepNumbers
.add($currentPage)
.add($prevPage)
.add($nextPage);
$pageNumbers.removeClass('hide')
.not($keepNumbers)
.addClass('hide');
}
$(window).resize(function (){
if($(this).width() > 767){
$pageNumbers.removeClass('hide');
} else {
updatePaginationLinks();
}
}).trigger('resize');
}
});
jQuery(window).on( 'load', function() {
var $ = jQuery;
jQuery('.btn-search-clear').hide();
var qsRegex;
var $grid = jQuery('.team-members').isotope({
itemSelector: '.element-item',
layoutMode: 'fitRows',
filter: function() {
if( jQuery(this).find('.person__name .first').text().match( qsRegex ) || jQuery(this).find('.person__name .last').text().match( qsRegex ) ){
return true;
}
//return qsRegex ? jQuery(this).find('.person__name .first').text().match( qsRegex ) : true;
},
getSortData: {
first: '.first', // text from querySelector
last: '.last',
moborder: '[data-moborder] parseInt',
default: '[data-order] parseInt'
}
// sortBy : 'last'
});
var sortBySelectedType = function(el){
// get href attribute, minus the '#'
var sortName = jQuery(el).attr('data-sort-option');
$grid.isotope({
sortBy : sortName,
sortAscending: true
});
return false;
}
jQuery('.record__dropdown a').on('click', function (e){
e.preventDefault();
sortBySelectedType(this);
});
var $recordValue = $('.record__value');
var selectedSort = $recordValue.attr('data-selected-sort');
var $selectedSortTarget = $('[data-sort-option=' + selectedSort + ']');
//sortBySelectedType($selectedSortTarget);
$grid.isotope({ sortBy : 'default',sortAscending: true });
$recordValue.html( $selectedSortTarget.text() + '');
$(window).resize(function (){
if($(this).width() < 991){
$grid.isotope({ sortBy : 'moborder',sortAscending: true });
} else {
$grid.isotope({ sortBy : 'default',sortAscending: true });
}
}).trigger('resize');
// use value of search field to filter
var $search__box = jQuery('.search__box').keyup( debounce( function() {
qsRegex = new RegExp( "^"+$search__box.val(), 'i' );
$input_value = (this.value.length);
$grid.isotope();
if($input_value > 0){
jQuery('.btn-search-clear').show();
}else{
jQuery('.btn-search-clear').hide();
}
var iso = $grid.filter(function(index, el){ return jQuery(el).data('isotope').filteredItems.length > 0 });
if(iso.length < 1){
jQuery('#msg-box').show();
jQuery('._team-description').addClass('hide');
}else{
jQuery('#msg-box').hide();
jQuery('._team-description').removeClass('hide');
}
}, 250 ) );
jQuery('.btn-search-clear').on( 'click', function() {
jQuery('.search__box').val('');
$search__box.trigger("keyup");
});
// 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 );
};
}
});