Advertisement
gheja

fullscreen js

Aug 30th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function goFullScreen()
  2. {
  3.     // based on https://developers.google.com/web/fundamentals/native-hardware/fullscreen/
  4. /*
  5.     let documentElement = window.document.documentElement;
  6.     let request = documentElement.requestFullscreen || documentElement.mozRequestFullScreen || documentElement.webkitRequestFullScreen || documentElement.msRequestFullscreen;
  7.     request.call(documentElement);
  8. */
  9.     let d = window.document.documentElement;
  10.     (d.requestFullscreen || d.mozRequestFullScreen || d.webkitRequestFullScreen || d.msRequestFullscreen).call(d);
  11. }
  12.  
  13. // must be called by an event handler in response to user interaction
  14. // also, can be safely called multiple times (no need to check if already full screen), request will be simply ignored
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement