μ λμ½ μ€ν¨ iframe μμ λΉμ¨ λ§μΆκΈ° 2
2020.05.31
μ΄μ μ μ¬λ¦° λ°©λ²μ μ¨λ΄λ λ¨Ήνμ§ μλλ€λ λ¬Έμκ° λ€μ΄μμ μλ‘μ΄ λ°©λ²μΌλ‘ λ μ¬λ €λ΄ λλ€. ν΄λΉ λ°©λ²μ μ°μλ©΄ μλν°μ html λͺ¨λμ iframe μμ μμ€λ₯Ό κ·Έλλ‘ λΆμ¬λ£κΈ°λ§ νκ³ μμ±νλ©΄ μλμΌλ‘ λΉμ¨μ΄ λ§μΆ°μ§λλ€.
<script>
//HTML </head> νΉμ </body> μμ λΆμ¬λ£κΈ°
$(document).ready(function(){
$(".article iframe").unwrap().wrap('<div class="youtube"></div>');
});
</script>
/* CSS νΈμ§μ°½ μμ λΆμ¬λ£κΈ°, μ΄λ―Έ μμ±λμ΄ μλ€λ©΄ μλ΅ */
.youtube{position:relative; width:100%; padding-bottom:56.25%;}
.youtube iframe{position:absolute; width:100%; height:100%;}