Adjust iframe height to avoid scrollbar
This commit is contained in:
@@ -9,4 +9,24 @@
|
|||||||
</article>
|
</article>
|
||||||
{% include "partials/components/contact-form.njk" %}
|
{% include "partials/components/contact-form.njk" %}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const iframeContainer = document.querySelector('.simulateur .iframe-container');
|
||||||
|
const iframe = document.getElementById('simulateurFrame');
|
||||||
|
const iframeContent = document.getElementById('simulateurFrame').contentWindow;
|
||||||
|
|
||||||
|
function setIframeHeight() {
|
||||||
|
iframe.style.height = iframeContent.document.body.scrollHeight + 'px';
|
||||||
|
iframeContainer.style.minHeight = iframeContent.document.body.scrollHeight + 'px';
|
||||||
|
iframeContainer.style.paddingTop = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe.addEventListener('load', () => {
|
||||||
|
setIframeHeight();
|
||||||
|
setTimeout(function() {
|
||||||
|
setIframeHeight(); // permet de reajuster apres chargement complet au besoin
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 90vh;
|
padding-top: 100%;
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user