Get started with set-iframe-height CDN

MIT licensed

Library adjusts iframe height to content size.

Tags:
  • iframe
  • responsive

Stable version

Copied!

How to start using set-iframe-height CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with set-iframe-height CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/set-iframe-height/2.1.1/set-iframe-height-parent-min.js"></script>
</head>
<body>
    <div style="height: 50vh; width: 100%;">
        <iframe id="myIframe" src="https://example.com" frameborder="0" loading="lazy" sandbox="allow-scripts allow-same-origin"></iframe>
    </div>

    <script>
        window.onload = function() {
            SetIframeHeight.init({
                selector: '#myIframe',
                enableAutosize: true,
                minHeight: 300,
                maxHeight: 800
            });
        };
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions