jQuery(document).ready(function($) {
$(".pw-newspage-latest-item .jet-more-wrap .btn__text").html(function(){
var text= $(this).text().trim().split(" ");
var last = text.pop();
return text.join(" ") + (text.length > 0 ? " " + last + "" : last);
});
// Floating label voor input fields animatie (contact pagina)
function checkForInput(element) {
// element is passed to the function ^
const $label = $(element).siblings('.jet-form__label');
if ($(element).val().length > 0) {
$label.addClass('input-has-value');
} else {
$label.removeClass('input-has-value');
}
}
// The lines below are executed on page load
$('input.jet-form__field, textarea.jet-form__field').each(function() {
checkForInput(this);
});
// The lines below (inside) are executed on change & keyup
$('input.jet-form__field, textarea.jet-form__field').on('change keyup', function() {
checkForInput(this);
});
// Floating label voor input fields animatie (footer)
function checkForInputFooter(element) {
// element is passed to the function ^
const $label = $(element).siblings('.raven-field-label');
if ($(element).val().length > 0) {
$label.addClass('input-has-value');
} else {
$label.removeClass('input-has-value');
}
}
// The lines below are executed on page load
$('input.raven-field').each(function() {
checkForInputFooter(this);
});
// The lines below (inside) are executed on change & keyup
$('input.raven-field').on('change keyup', function() {
checkForInputFooter(this);
});
// Floating label voor input fields animatie (reviews)
function checkForInputReview(element) {
// element is passed to the function ^
const $label = $(element).siblings('.field_wrapper label');
if ($(element).val().length > 0) {
$label.addClass('input-has-value');
} else {
$label.removeClass('input-has-value');
}
}
// The lines below are executed on page load
$('.field_wrapper input, .field_wrapper textarea').each(function() {
checkForInputReview(this);
});
// The lines below (inside) are executed on change & keyup
$('.field_wrapper input, .field_wrapper textarea').on('change keyup', function() {
checkForInputReview(this);
});
//On input focus move the label
$(".pw-input-class input, .pw-input-class textarea").focus(function() {
$(this).parent().siblings(".pw-input-class label").addClass("move");
});
//On focusout check if there is a value, else remove the .move class.
$(".pw-input-class input, .pw-input-class textarea").focusout(function() {
if ($(this).val().length == 0) {
$(this).parent().siblings("label").removeClass("move");
}
});
//If the user clicks on the label itself, activate the corresponding input.
var labelID;
$('.pw-input-class label').click(function () {
labelID = $(this).attr('for');
$('#' + labelID).trigger('click');
});
//In case there is a prefill value
$(".pw-input-class input, .pw-input-class textarea").each(function() {
if ($(this).val().length != 0) {
$(this).parent().siblings(".pw-input-class label").addClass("move");
}
else {
$(this).parent().siblings(".pw-input-class label").removeClass("move");
}
});
// ====== RESPONSIVE MENU TOGGLE ====== //
// toggle menu open or closed ( < 1024px )
$('.pw_menu-toggle').click(function() {
$('.pw_side-menu').toggleClass('menu_open');
$('body').css('overflow','hidden');
});
// close menu when clicked on close icon (when menu is open) ( < 1024px )
$('.pw_close-side-menu .elementor-icon').click(function() {
$('.pw_side-menu').removeClass('menu_open');
$('body').css('overflow','unset');
});
// click to TOGGLE particulier/zakelijk mega menu on smaller screens ( < 1024px )
$('.particulier-financial').click(function() {
$('.mega-menu_particulier').toggleClass('active-mega-menu');
$('.pw_side-menu').addClass('before-mega-menu'); // add background-color for elastic animation on mobile
});
$('.zakelijk-financial').click(function() {
$('.mega-menu_zakelijk').toggleClass('active-mega-menu');
$('.pw_side-menu').addClass('before-mega-menu'); // add background-color for elastic animation on mobile
});
// click to HIDE particulier/zakelijk mega menu on smaller screens ( < 1024px )
$('.particulier-megamenu_back-btn').click(function() {
$('.mega-menu_particulier').toggleClass('active-mega-menu');
$('.pw_side-menu').removeClass('before-mega-menu');
});
$('.zakelijk-megamenu_back-btn').click(function() {
$('.mega-menu_zakelijk').toggleClass('active-mega-menu');
$('.pw_side-menu').removeClass('before-mega-menu');
});
// ====== END RESPONSIVE MENU TOGGLE ====== //
// ====== BEGIN LINK WRAP FOR NEW TEAM PAGE ====== //
var getLang = document.getElementsByTagName('html')[0].getAttribute('lang');
$('.pw-listing-team .jet-listing-grid__item').each(function(){
var getName = $(this).find('.pw-name-title-team h2').text();
var convertName = getName.replace(/\s+/g, '-').toLowerCase();
var cleanName = convertName.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
var languageAddon = '';
if (getLang == 'en-US') {
var languageAddon = '?lang=en';
}
$(this).find('.pw-team-list-st').wrapAll('');
});
// ====== END LINK WRAP FOR NEW TEAM PAGE ====== //
});