Obtenga el valor máximo de la matriz - módulos Divi
const mainBlog = document.querySelector('.main_blg')
if (mainBlog != null || mainBlog != undefined) {
let titleHeights = []
let contentHeights = []
const root = document.querySelector(':root');
const articles = mainBlog.querySelectorAll('article')
if (articles.length > 0) {
articles.forEach(article => {
const title = article.querySelector('.entry-title')
const content = article.querySelector('.post-content-inner')
titleHeights.push(title.clientHeight)
contentHeights.push(content.clientHeight)
})
const maxTitle = titleHeights.reduce((a, b) => {
return Math.max(a, b)
});
const maxContent = contentHeights.reduce((a, b) => {
return Math.max(a, b)
});
root.style.setProperty('--title-height', `${maxTitle}px`);
root.style.setProperty('--content-height', `${maxContent}px`);
}
}
Victorious Vole