Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-bhaumik authored May 28, 2024
1 parent c2360ca commit f8a76bb
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
});

document.addEventListener('DOMContentLoaded', () => {
const fullscreenBtn = document.getElementById('fullscreenBtn');

Expand Down Expand Up @@ -144,33 +145,3 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
});

document.addEventListener('DOMContentLoaded', () => {
const fullscreenBtn = document.getElementById('fullscreenBtn');

fullscreenBtn.addEventListener('click', () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen()
.then(() => {
fullscreenBtn.textContent = 'Exit Fullscreen';
})
.catch(err => {
console.error(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`);
});
} else {
document.exitFullscreen()
.then(() => {
fullscreenBtn.textContent = 'Fullscreen';
})
.catch(err => {
console.error(`Error attempting to disable fullscreen mode: ${err.message} (${err.name})`);
});
}
});

document.addEventListener('fullscreenchange', () => {
if (!document.fullscreenElement) {
fullscreenBtn.textContent = 'Fullscreen';
}
});
});

0 comments on commit f8a76bb

Please sign in to comment.