About The Eventos
jQuery(document).ready(function () {
var containerEl = document.querySelector('#mep_event_list_abr68b225c13a640');
var mixer = mixitup(containerEl, {
selectors: {
target: '.mep-event-list-loop',
control: '[data-mixitup-control]'
}
});
// Handle title filter input
jQuery('input[name="filter_with_title"]').on('keyup', function () {
var searchText = jQuery(this).val().toLowerCase();
var items = jQuery('.mep-event-list-loop');
items.each(function () {
var itemTitle = jQuery(this).data('title').toLowerCase();
if (itemTitle.indexOf(searchText) > -1) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
});
// Handle date filter change
jQuery('input[name="filter_with_date"]').on('change', function () {
var selectedDate = jQuery(this).val();
var items = jQuery('.mep-event-list-loop');
if (!selectedDate) {
items.show();
} else {
var filterDate = new Date(selectedDate);
filterDate.setHours(0, 0, 0, 0); // Reset time part for date comparison
items.each(function () {
var itemDate = new Date(jQuery(this).data('date'));
itemDate.setHours(0, 0, 0, 0); // Reset time part for date comparison
if (itemDate.getTime() === filterDate.getTime()) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
}
});
// Handle state filter change
jQuery('select[name="filter_with_state"]').on('change', function () {
var state = jQuery(this).val();
var items = jQuery('.mep-event-list-loop');
if (state === '') {
items.show();
} else {
items.each(function () {
var itemState = jQuery(this).data('state');
if (itemState === state) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
}
});
// Handle city filter change
jQuery('select[name="filter_with_city"]').on('change', function () {
var city = jQuery(this).val();
var items = jQuery('.mep-event-list-loop');
if (city === '') {
items.show();
} else {
items.each(function () {
var itemCity = jQuery(this).data('city-name');
if (itemCity === city) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
}
});
});