Troubleshooting of full-screen display and full-screen display
Code first
Window. isflsgrn = false; // whether to enter the full screen flag below ie11. true indicates full screen, and false indicates non-full screen window. ieIsfSceen = false; // whether or not ie11 enters the full screen flag. true indicates full screen, false is not in full screen status // cross-browser returns whether the current document has entered the status function fullscreenEnable () {var isFullscreen = document. fullscreenEnabled | window. fullScreen | document. mozfullscreenabled | document. webkitIsFullScreen; return isFullscreen;} // full screen var fScreen = function () {var docElm = document. d OcumentElement; if (docElm. requestFullscreen) {docElm. requestFullscreen ();} else if (docElm. msRequestFullscreen) {docElm. msRequestFullscreen (); ieIsfSceen = true;} else if (docElm. required requestfullscreen) {docElm. required requestfullscreen ();} else if (docElm. webkitRequestFullScreen) {docElm. webkitRequestFullScreen ();} else {// does not support full-screen API browser processing, hiding the elements that do not need to be displayed window. parent. hideTopBottom (); isflsgrn = true; $ ("# Fsbutton "). text ("exit full screen") ;}// exit full screen var cfScreen = function () {if (document. exitFullscreen) {document. exitFullscreen ();} else if (document. msExitFullscreen) {document. msExitFullscreen ();} else if (document. mozCancelFullScreen) {document. canccancelfullscreen ();} else if (document. webkitCancelFullScreen) {document. webkitCancelFullScreen ();} else {window. parent. showTopBottom (); isflsgrn = False; $ ("# fsbutton "). text ("full screen") ;}}// Click Event $ ("# fsbutton") in full screen mode "). click (function () {var isfScreen = fullscreenable (); if (! IsfScreen & isflsgrn = false) {if (ieIsfSceen = true) {document. msExitFullscreen (); ieIsfSceen = false; return;} fScreen () ;}else {cfScreen () ;}) // keyboard operation $ (document ). keydown (function (event) {if (event. keyCode = 27 & ieIsfSceen = true) {ieIsfSceen = false ;}}); // listener status change if (window. addEventListener) {document. addEventListener ('fullscreenchang', function () {if ($ ("# fsbutton "). text () = "full screen") {$ ("# fsbutton "). text ("exit full screen");} else {$ ("# fsbutton "). text ("full screen") ;}}); document. addEventListener ('webkitfullscreenchang', function () {if ($ ("# fsbutton "). text () = "full screen") {$ ("# fsbutton "). text ("exit full screen");} else {$ ("# fsbutton "). text ("full screen") ;}}); document. addEventListener ('effecfullscreenchang', function () {if ($ ("# fsbutton "). text () = "full screen") {$ ("# fsbutton "). text ("exit full screen");} else {$ ("# fsbutton "). text ("full screen") ;}}); document. addEventListener ('msfullscreenchang', function () {if ($ ("# fsbutton "). text () = "full screen") {$ ("# fsbutton "). text ("exit full screen");} else {$ ("# fsbutton "). text ("full screen ");}});}
It is worth noting that the fullscreenEnabled parameter is not the same on the Internet. Some are browser monitoring.Whether the status of the request full screen mode is enabledIn some cases, it is only a flag to determine whether the browser supports full screen. In actual use, the problem occurs. IE11 cannot recognize this attribute, you need to set a flag to control whether IE11 is in full screen status.
This article is original. For more information, see the source.
Front-end Communication Group, which provides a large number of documents, books, and materials. We look forward to your participation! GROUP: 127768464
Front-end Communication Group, which provides a large number of documents, books, and materials. We look forward to your participation! GROUP: 127768464