https://blog.kakaocdn.net/dn/6eYgX/btr0fJLgPoX/EHkvCpbsRK98G9lxcHZLN0/tfile.html
모바일에서 가로 세로로 이리 저리 돌려 보세요.
[code]
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10">
<meta http-equiv="imagetoolbar" content="no">
<title>wittazzurri youtube</title>
<style>
body { margin:0px; }
#mainDiv { position:absolute; padding:20px; box-sizing:border:box; }
#ytDiv { width:100%; height:100vh; position:fixed; display:flex; align-items:center; overflow:hidden; margin:0 auto; }
#ytPercent { width:100%; position:relative; overflow:hidden; display:flex; justify-content:center; }
#ytPlayer { display:block; position:absolute; height:400%; top:-150%;}
#ytPercent div { display:block; position:absolute; top:0%; width:100%; height:100%; }
</style>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
ytID = "TSBGN9VaiMA";
function onYouTubeIframeAPIReady() {
ytPlayer = new YT.Player("ytPlayer", {
events: {
"onReady": (yt) => {
yt.target.loadVideoById(ytID);
yt.target.mute();
},
"onStateChange": (yt) => { if (yt.data === 0) yt.target.loadVideoById(ytID); }
}
});
}
function ytFullSize() {
if (ytDiv.offsetHeight / ytDiv.offsetWidth <= 9 / 16) {
ytPlayer.style.width = "100%";
ytPercent.style.paddingTop = "56.25%";
}
else {
ytPlayer.style.width = ytDiv.offsetHeight * 16 / 9 + "px";
ytPercent.style.paddingTop = 56.25 * ytPercent.offsetWidth * ytDiv.offsetWidth / 100 + "%";
}
}
document.addEventListener("DOMContentLoaded", ytFullSize);
addEventListener("resize", ytFullSize);
</script>
</head>
<body>
<div id="ytDiv"><div id="ytPercent"><div id="ytPlayer"></div><div></div></div></div>
<div id="mainDiv">
여기에 내용물을 넣으세요.
</div>
</body>
</html>
[/code]
https://sir.kr/qa/489861
댓글 9개
사실 이건 아래 코드를 지우고
<div id="mainDiv">
여기에 내용물을 넣으세요.
</div>
----------
아래처럼 소스를 약간 수정한 후 youtube.php 로 저장한 후
<?php $yt = $_GET['yt']; ?>
ytID = "<?php echo $yt; ?>";
다른 페이지에서 아이프레임으로 불러도 됩니다. 물론 아이프레임의 css 등은 본인이 직접...
그럼 코드가 한결 짧아지죠.
<iframe src="youtube.php?yt=유튜브아이디" ......></iframe>
게시글 목록
| 번호 | 제목 |
|---|---|
| 17591 |
node.js
노드로 멀티스레드 기능 구현하기
2
|
| 17590 | |
| 17589 |
PHP
PHP로 인쇄명령주기
1
|
| 17588 |
JavaScript
Javascript로 JSON데이터를 보기좋게 만들기
|
| 17587 | |
| 17584 | |
| 17583 |
MySQL
MySQL과 PostgreSQL의 우단점
|
| 17582 |
MySQL
프로시저 cursor 사용 예
|
| 17581 |
JavaScript
바닐라 ajax 파일업로드 예제
|
| 17579 | |
| 17577 | |
| 17575 | |
| 17574 | |
| 17573 | |
| 17572 | |
| 17569 | |
| 17564 | |
| 17560 | |
| 17559 |
MySQL
프로시저 기본편
|
| 17555 | |
| 17554 | |
| 17553 | |
| 17552 | |
| 17549 | |
| 17548 | |
| 17547 | |
| 17542 | |
| 17533 | |
| 17531 | |
| 17524 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기