Last active
January 9, 2018 06:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
function ready(fn) { | |
if (document.readyState != 'loading') { | |
fn(); | |
} else { | |
document.addEventListener('DOMContentLoaded', fn); | |
} | |
} | |
ready(function() { | |
var elems = document.querySelectorAll('div.myclub-embed'); | |
Array.prototype.forEach.call(elems, setupElement); | |
}); | |
function setupElement(elem) { | |
var url = elem.getAttribute('data-url'); | |
if (url) { | |
var iFrame = document.createElement('iframe'); | |
iFrame.src = url; | |
iFrame.scrolling = 'no'; | |
iFrame.style.border = '0px'; | |
// To counter iOS iframe width bug, | |
// see https://stackoverflow.com/questions/23823615/an-iframe-is-wider-than-it-should-on-iphone | |
iFrame.style.width = '1px'; | |
iFrame.style.minWidth = '100%'; | |
elem.appendChild(iFrame); | |
iFrameResize({ checkOrigin: false }, iFrame); | |
} | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment