Only wrap iframes that don't specify their own height

(master version of e183a5406c)
This commit is contained in:
Nate Weaver 2020-07-02 04:32:58 -05:00
parent 9815e19f01
commit dc57981376
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,9 @@
// Here we are making iframes responsive. Particularly useful for inline Youtube videos.
function wrapFrames() {
document.querySelectorAll("iframe").forEach(element => {
if (element.height > 0 || parseInt(element.style.height) > 0)
return;
var wrapper = document.createElement("div");
wrapper.classList.add("iframeWrap");
element.parentNode.insertBefore(wrapper, element);