fiksna enota ohrani svojo visino: prilagajanje kreativi je 300x400 raztegnilo na 300x600

This commit is contained in:
2026-08-31 16:43:25 +02:00
parent 71bfa3ad9b
commit c507289753
+3
View File
@@ -50,6 +50,9 @@ export default function AdSense({
// Nic se ne odreze - visina je natanko taksna kot oglas. // Nic se ne odreze - visina je natanko taksna kot oglas.
let fitTimers: ReturnType<typeof setTimeout>[] = []; let fitTimers: ReturnType<typeof setTimeout>[] = [];
const fitToCreative = () => { const fitToCreative = () => {
// Enota s trdno visino v style (fiksne Display enote) se ne prilagaja
// kreativi, sicer nam Google 300x400 razpotegne na 300x600.
if (style && typeof (style as any).height === "string") return;
const f = ins?.querySelector("iframe") as HTMLIFrameElement | null; const f = ins?.querySelector("iframe") as HTMLIFrameElement | null;
if (!ins || !f) return; if (!ins || !f) return;
const h = f.getBoundingClientRect().height; const h = f.getBoundingClientRect().height;