Özel HTML
<html><h1>Birinci başlık</h1> <h2>İkinci başlık</h2> <h3>Üçüncü başlık</h3> <h4>Dördüncü başlık</h4> <h5>Beşinci başlık</h5> <h6>Altıncı başlık</h6><img></body> <!-- scripts --> <script> // Global variables var scrollbarHeightOffset = 20; var lastHeight; var newHeight; // Check if the iframe is adaptive or not // On document height change we seed to tell the parent window resize this window onElementHeightChange(document.body, function() { resize((lastHeight + scrollbarHeightOffset)); }); // Set initialize height resize((lastHeight + scrollbarHeightOffset)); // we the height again just to be sure if there is a slow computer or something else it will fix it (we didn't found a bug when we removed it) setTimeout(function() { resize((lastHeight + scrollbarHeightOffset)); }, 1000); setTimeout(function() { resize((lastHeight + scrollbarHeightOffset)); }, 5000); /** * The function is detecting whenever the element height is changed * and running the callback to adapt the iframe element */ function onElementHeightChange( elm, callback ) { // refresh the variable lastHeight = elm.clientHeight; // the function is checking with a timer if the element height is changed (function run() { // get new element height newHeight = elm.clientHeight; // check if height is changed if ( lastHeight != newHeight ) { lastHeight = newHeight; callback(); } // clear timer if ( elm.onElementHeightChangeTimer ) { clearTimeout(elm.onElementHeightChangeTimer); } // add new timer elm.onElementHeightChangeTimer = setTimeout(run, 200); })(); } /** * Resize this iframe from the parent */ function resize( height ) { window.parent.postMessage({ id: "1704654938931659af85ab3c46", eventType: 'resize', height: height },"*"); } </script> </html>