2
I have a iframe
with a youtube video inside it.
I want him to have the 100% page readout, that’s okay, but I want the height to be proportional to the width.
<div style="text-align:center;">
<iframe id="video" style="width:100%; margin-bottom:0px;" src="https://www.youtube.com/embed/zVWJR4K5Vt4?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<script>
//pego a largura
largura = screen.width;
//utilizo uma regra de três pra calcular a altura
altura = largura * 315 / 560;
//aqui é onde eu tento alterar a altura via código, mas não está funcionando
Document.getElementById('video').css('height', altura);
</script>
There is no Document the correct is Document.
– LeAndrade
Tbm is not how you change css through Javascript, that’s how it is:
document.getElementById('video').style.height = altura;
– LeAndrade