Skip to content

Commit 6411241

Browse files
Add hideAdContainerIfEmpty function
1 parent 9963c70 commit 6411241

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

site/src/components/Ads.astro

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,16 @@
88
src="https://cdn.carbonads.com/carbon.js?serve=CKYIKKJL&placement=getbootstrapcom"
99
id="_carbonads_js"
1010
></script>
11-
</div>
11+
</div>
12+
13+
<script is:inline>
14+
function hideAdContainerIfEmpty() {
15+
const adContainer = document.querySelector('.ad-container');
16+
const carbonAds = document.querySelector('#carbonads');
17+
if (adContainer &&!carbonAds) {
18+
adContainer.style.minHeight = '0';
19+
}
20+
}
21+
22+
document.addEventListener('DOMContentLoaded', hideAdContainerIfEmpty);
23+
</script>

0 commit comments

Comments
 (0)