Pictures!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Slides</title>
  6. <style>
  7. html, body {
  8. margin: 0px;
  9. padding: 0px;
  10. height: 100%;
  11. overflow: hidden;
  12. }
  13. #_overlay {
  14. z-index: 2;
  15. }
  16. #_main {
  17. z-index: 1;
  18. }
  19. ._content {
  20. background: white;
  21. position: absolute;
  22. width: 100%;
  23. height: 100%;
  24. top: 0px;
  25. left: 0px;
  26. }
  27. ._content {
  28. text-align: center;
  29. }
  30. ._content h1 { font-size: 5em }
  31. ._content h2 { font-size: 4.5em }
  32. ._content h3 { font-size: 4em }
  33. ._content p { font-size: 2.2em }
  34. ._content .fullscreen {
  35. position: absolute;
  36. width: auto;
  37. height: 100%;
  38. top: 0px;
  39. left: 50%;
  40. -moz-transform: translateX(-50%);
  41. -ms-transform: translateX(-50%);
  42. -webkit-transform: translateX(-50%);
  43. transform: translateX(-50%);
  44. }
  45. #_overlay {
  46. transition: opacity 1s;
  47. opacity: 1;
  48. }
  49. #_overlay.hidden {
  50. opacity: 0;
  51. }
  52. </style>
  53. </head>
  54. <body>
  55. <div id="_main" class="_content"></div>
  56. <div id="_overlay" class="_content"></div>
  57. <script>
  58. var overlay = () => document.querySelector("#_overlay");
  59. var main = () => document.querySelector("#_main");
  60. // Swap the IDs of two elements
  61. function swap(elem1, elem2) {
  62. var tmp = elem1.id;
  63. elem1.id = elem2.id;
  64. elem2.id = tmp;
  65. }
  66. // Change slides with a transition
  67. function update() {
  68. overlay().innerHTML = "";
  69. overlay().className = "_content";
  70. swap(main(), overlay());
  71. fetch("/slide")
  72. .then(response => response.text())
  73. .then(text => {
  74. setTimeout(() => {
  75. main().innerHTML = text;
  76. overlay().className = "_content hidden";
  77. }, 1000);
  78. })
  79. .catch(err => console.error(err));
  80. // Wait for the next slide change, then update again
  81. fetch("/await")
  82. .then(response => update())
  83. .catch(err => { console.error(err); update(); });
  84. }
  85. update();
  86. </script>
  87. </body>
  88. </html>