Guest User

Untitled

a guest
Feb 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Fullscreen demo</title>
  6. <style>
  7. body {
  8. font-family: 'Myriad Pro', Arial;
  9. }
  10. p {
  11. margin: 0;
  12. }
  13. #fullscreen__control {
  14. display: inline-block;
  15. margin: 20px auto 0;
  16. text-align: center;
  17. }
  18. #fullscreen__element {
  19. width: 50%;
  20. margin: 10% auto;
  21. background: rgba(0,0,0, .05);
  22. padding: 2em;
  23. }
  24. body:-webkit-full-screen-document {
  25. background: #ccc;
  26. }
  27. #fullscreen__element:-webkit-full-screen-document {
  28. color: #fff;
  29. background: #ccc;
  30. width: 100%;
  31. height: 100%;
  32. margin: 0;
  33. box-sizing: border-box;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div id="fullscreen__element">
  39. <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  40. <button id="fullscreen__control">полноэкранный режим</button>
  41. </div>
  42. <script>
  43. var fullscreen__control = document.getElementById('fullscreen__control'),
  44. fullscreen__element = document.getElementById('fullscreen__element');
  45.  
  46. fullscreen__control.addEventListener('click', function(event) {
  47. if (document.webkitCurrentFullScreenElement == fullscreen__element) {
  48. document.webkitCancelFullScreen();
  49. fullscreen__control.innerHTML = 'полноэкранный режим';
  50. } else {
  51. fullscreen__element.webkitRequestFullScreen();
  52. fullscreen__control.innerHTML = 'обычный режим';
  53. }
  54. }, false);
  55. </script>
  56. </body>
  57. </html>
Add Comment
Please, Sign In to add comment