Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion hlx_statics/blocks/iframe/iframe.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@ main div.iframe-wrapper .iframe-custom-width{
display: flex;
align-items: center;
justify-content: center;
}
}

/* 16:9 only for iframe blocks authored with the aspect-video variant;
skip when data-height is set (.iframe-has-explicit-height) or YouTube (.youtube-iframe). */
main div.iframe-wrapper iframe.iframe-container.aspect-video:not(.youtube-iframe):not(.iframe-has-explicit-height) {
height: auto !important;
aspect-ratio: 16 / 9;
}
6 changes: 4 additions & 2 deletions hlx_statics/blocks/iframe/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ export default async function decorate(block) {
}

if (width) {
iframe.style.width = width;
iframe.style.setProperty('width', width, 'important');
}
if (height) {
iframe.style.height = height;
iframe.classList.add('iframe-has-explicit-height');
iframe.style.setProperty('height', height, 'important');
iframe.classList.add('iframe-has-explicit-height');
}

penpalScript.onload = () => {
Expand Down
Loading