상세페이지 유튜브 사이즈 문의드립니다. 채택완료
https://sir.kr/g5_tip/13299 팁의 내용입니다.
영카트 상품뷰 item.form.skin.php
<script type="text/javascript">
$(window).resize(function(){resizeYoutube();});
$(function(){resizeYoutube();});
function resizeYoutube(){ $("iframe").each(function(){ if( /^https?:\/\/www.youtube.com\/embed\//g.test($(this).attr("src")) ){ $(this).css("width","100%"); $(this).css("height",Math.ceil( parseInt($(this).css("width")) * 480 / 854 ) + "px");} }); }
</script>
위의 스크립트로 유튜브 반응형으로 모바일 보기시에 정상적으로 됩니다.
상품설명 > html > 유튜브를 올리고 Editor 로 보면 정상이나
<iframe width="500" height="300" src="유튜브 주소" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
저장후에 상세페이지를 보면 사이즈가 적용이 안됩니다.
고수님 도와주세요~!
답변 2개
답변에 대한 댓글 2개
해보겠습니다.
댓글을 작성하려면 로그인이 필요합니다.
에디터에서 작성한 스크립트 및 태그의 아이디 등은 보안 문제로 제거 되어 출력됩니다.
에디터가 아닌 해당 php파일에서 직접 수정하셔야 합니다
답변에 대한 댓글 3개
스크립트는 item.form.skin.php 에 넣은 거구요
에디터에 <iframe width="500" height="300" src="유튜브 주소" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
을 넣은거에요~
해당 태그가 상단에 있거나 해당 유튜브태그보다 위에 있는지 확인해보세요
스크립트 삭제하면 pc는 사이즈 적용되어 출력됩니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인