Skip to content containers.forEach(function(container){
var items = container.querySelectorAll('.post-grid-item, .pgs-item, .elementor-post, .grid-item, .jeg_post, .post');
applyEqualize(items);
});
}function applyEqualize(items) {
if (!items || items.length === 0) return;
var titles = [];
items.forEach(function(item){
// try common title selectors inside each item
var title = item.querySelector('h1, h2, h3, .entry-title, .post-title, .pg-title, .elementor-post__title, .jeg_post_title, .post-title a');
if (title) titles.push(title);
});
if (titles.length === 0) return;
// reset first
titles.forEach(function(t){ t.style.minHeight = ''; t.style.removeProperty('min-height'); });
var max = 0;
titles.forEach(function(t){
var h = t.getBoundingClientRect().height;
if (h > max) max = h;
});
if (max > 0) {
titles.forEach(function(t){
// set with important to override inline CSS from theme if needed
t.style.setProperty('min-height', Math.ceil(max) + 'px', 'important');
});
}
}// run on DOM ready and again on load (images) and on resize
document.addEventListener('DOMContentLoaded', equalizeGridTitles);
window.addEventListener('load', equalizeGridTitles);
window.addEventListener('resize', function(){ setTimeout(equalizeGridTitles, 150); });
})();