document.addEventListener(“DOMContentLoaded”, function () {
const gameContainer = document.getElementById(“gameContainer”);
const fullscreenBtn = document.getElementById(“fullscreenBtn”);
const iframe = document.getElementById(“embededGame”);
// Hàm kích hoạt fullscreen trên mọi thiết bị
function enterFullscreen() {
if (gameContainer.requestFullscreen) {
gameContainer.requestFullscreen();
} else if (gameContainer.mozRequestFullScreen) { // Firefox
gameContainer.mozRequestFullScreen();
} else if (gameContainer.webkitRequestFullscreen) { // Chrome, Safari, iOS
gameContainer.webkitRequestFullscreen();
} else if (gameContainer.msRequestFullscreen) { // IE/Edge
gameContainer.msRequestFullscreen();
}
}
// Thoát fullscreen khi cần
function exitFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) { // Firefox
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) { // Chrome, Safari, iOS
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) { // IE/Edge
document.msExitFullscreen();
}
}
// Sự kiện khi nhấn nút để bật fullscreen
fullscreenBtn.addEventListener(“click”, function () {
enterFullscreen();
});
// Hỗ trợ tự động fullscreen khi chạm vào màn hình trên điện thoại
gameContainer.addEventListener(“touchstart”, function () {
if (!document.fullscreenElement) {
enterFullscreen();
}
});
// Thoát fullscreen khi nhấn ESC trên máy tính
document.addEventListener(“keydown”, function (e) {
if (e.key === “Escape”) {
exitFullscreen();
}
});
// Tối ưu hiển thị trên điện thoại khi xoay ngang
window.addEventListener(“orientationchange”, function () {
setTimeout(() => {
if (window.innerHeight > window.innerWidth) {
alert(“Vui lòng xoay ngang thiết bị để chơi game tốt hơn!”);
}
}, 500);
});
});
excellent issues altogether, you simply received a emblem new reader.
What could you suggest in regards to your publish that you just made some days ago?
Any sure?
I visited several web sites however the audio feature for audio songs current at this web site is actually superb. http://blog-kr.dreamhanks.com/question/foyer-electrique-exterieur-a-quebec-confort-et-ambiance-sans-fumee-133/
excellent issues altogether, you simply received a emblem new reader.
What could you suggest in regards to your publish that you just made some days ago?
Any sure?
Heya i am for the first time here. I came across this board and I find It truly useful & it helped me out a lot.
I hope to give something back and help others like you helped me. http://www.pretty4u.co.kr/new/bbs/board.php?bo_table=free&wr_id=3498016
Hi colleagues, its enormous post about cultureand entirely explained, keep it up all the time.