i made a button to full screen mode in my web page using js , but whenever i switch the url the full screen exit !? but when i use F11 to full screen it works fine! ?
<script>
function getFullscreenElement(){
return document.fullscreenElement
|| document.webkitFullscreenElement
|| document.mozFullscreenElement
|| document.msFullscreenElement;
}
function toggleFullscreen(){
if (getFullscreenElement()) {
document.exitFullscreen();
}else{
document.documentElement.requestFullscreen().catch(console.log(e));
}
}
document.getElementById('expand').addEventListener('click',function() {
toggleFullscreen();
});
</script>
<p id="expand"><i title='full screen' class="fas fa-expand-arrows-alt"></i></p>it there something i have missed !? thank you ..
Aucun commentaire:
Enregistrer un commentaire