Skip to content

Commit

Permalink
added optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
JingleH committed Nov 16, 2024
1 parent 70a35e4 commit 7233dd4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions express/blocks/discover-cards/discover-cards.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createTag, yieldToMain } from '../../scripts/utils.js';
import buildGallery from '../../features/gallery/gallery.js';
import { debounce } from '../../scripts/hofs.js';

async function syncMinHeights(groups) {
const maxHeights = groups.map((els) => els
Expand Down Expand Up @@ -56,6 +57,9 @@ export default async function decorate(block) {
obs.unobserve(block);
syncMinHeights(cardParagraphs);
}).observe(block);
window.addEventListener('resize', debounce(() => {
syncMinHeights(cardParagraphs);
}, 100));

const imageSize = document.body.dataset.device === 'desktop' ? 'large' : 'small';
block.style.backgroundImage = `
Expand Down

0 comments on commit 7233dd4

Please sign in to comment.