-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (18 loc) · 712 Bytes
/
script.js
File metadata and controls
26 lines (18 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const greetingElement = document.getElementById("greeting");
const currentHour = new Date().getHours();
const greetingMessage =
currentHour >= 5 && currentHour < 12
? "Bom dia"
: currentHour >= 12 && currentHour < 18
? "Boa tarde"
: "Boa noite";
greetingElement.textContent = greetingMessage;
const container = document.querySelector(".offer__list-item");
const observer = new ResizeObserver(() => {
const containerWidth = container.offsetWidth;
const numColumns = Math.floor(containerWidth / 200);
container.style.gridTemplateColumns = `repeat(${numColumns}, minmax(200px, 1fr))`;
console.log({ container });
console.log({ numColumns });
});
observer.observe(container);