Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.addEventListener('DOMContentLoaded', function () {
- let timeout;
- function setEqualHeight() {
- let items = document.querySelectorAll('.review-item');
- let maxHeight = Math.max(...Array.from(items, item => {
- item.style.height = '';
- return item.offsetHeight;
- }));
- items.forEach(item => item.style.height = `${maxHeight}px`);
- };
- document.fonts.ready
- .then(() => {
- setTimeout(function () {
- setEqualHeight();
- }, 100)
- })
- .catch(() => {
- console.log("Fonts loading error");
- });
- window.addEventListener('resize', ()=> {
- if (timeout) {
- clearInterval(timeout);
- };
- timeout = setTimeout(() => {
- setEqualHeight();
- }, 50);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement