tour2.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>韶山毛泽东同志纪念馆</title>
  5. <meta
  6. name="viewport"
  7. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"
  8. />
  9. <meta name="apple-mobile-web-app-capable" content="yes" />
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  12. <meta http-equiv="x-ua-compatible" content="IE=edge" />
  13. <style>
  14. @-ms-viewport {
  15. width: device-width;
  16. }
  17. @media only screen and (min-device-width: 800px) {
  18. html {
  19. overflow: hidden;
  20. }
  21. }
  22. html {
  23. height: 100%;
  24. }
  25. body {
  26. height: 100%;
  27. overflow: hidden;
  28. margin: 0;
  29. padding: 0;
  30. font-family: Arial, Helvetica, sans-serif;
  31. font-size: 16px;
  32. color: #ffffff;
  33. background-color: #000000;
  34. }
  35. .right-tools {
  36. position: fixed;
  37. right: 21px;
  38. bottom: 17px;
  39. font-size: 0;
  40. z-index: 3001;
  41. }
  42. .right-tools > * {
  43. cursor: pointer;
  44. width: 50px;
  45. }
  46. .right-tools > *:not(:first-child) {
  47. margin-left: 16px;
  48. }
  49. #back {
  50. position: fixed;
  51. z-index: 3001;
  52. top: 31px;
  53. left: 16px;
  54. cursor: pointer;
  55. }
  56. #vr-musicOpen {
  57. display: none;
  58. }
  59. @media screen and (max-width: 1250px) {
  60. .right-tools {
  61. bottom: calc(17px + 50px);
  62. > * {
  63. width: 40px;
  64. }
  65. > *:not(:first-child) {
  66. margin-left: 10px;
  67. }
  68. }
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <script src="tour.js"></script>
  74. <img id="back" src="./skin/icon-back-1.png" />
  75. <!-- 音乐 -->
  76. <audio id="myAudio" src="./skin/musicBac.mp3" style="display: none"></audio>
  77. <div class="right-tools">
  78. <img id="vr-musicOpen" src="./skin/icon-musicOpen.png" />
  79. <img id="vr-musicClose" src="./skin/icon-musicClose.png" />
  80. <img id="vr-home" src="./skin/icon-home.png" />
  81. <img id="vr-360" src="./skin/icon-360.png" />
  82. <!-- <img id="vr-icon" src="./skin/icon-VR.png" /> -->
  83. </div>
  84. <div id="pano" style="width: 100%; height: 100%">
  85. <noscript
  86. ><table style="width: 100%; height: 100%">
  87. <tr style="vertical-align: middle">
  88. <td>
  89. <div style="text-align: center">
  90. ERROR:<br /><br />Javascript not activated<br /><br />
  91. </div>
  92. </td>
  93. </tr></table
  94. ></noscript>
  95. <script>
  96. var krpano = null;
  97. var vr360Button = document.getElementById("vr-360");
  98. var AUTOROTATE_KEY = "autorotate";
  99. var urlParams = new URLSearchParams(location.search);
  100. embedpano({
  101. swf: "tour.swf",
  102. xml: urlParams.get("id") + ".xml",
  103. target: "pano",
  104. html5: "auto",
  105. mobilescale: 1.0,
  106. passQueryParameters: true,
  107. onready: function (k) {
  108. krpano = k;
  109. handle360Icon(
  110. Boolean(Number(localStorage.getItem(AUTOROTATE_KEY))),
  111. true
  112. );
  113. },
  114. });
  115. var homeButton = document.getElementById("vr-home");
  116. homeButton.addEventListener("click", function () {
  117. window.parent.postMessage(
  118. {
  119. openPopup: true,
  120. },
  121. "*"
  122. );
  123. });
  124. // var vrButton = document.getElementById("vr-icon");
  125. // vrButton.addEventListener("click", function () {
  126. // if (krpano) krpano.call("webvr.enterVR();");
  127. // });
  128. vr360Button.addEventListener("click", function () {
  129. var autorotateEnabled = krpano.get("autorotate.enabled");
  130. handle360Icon(!autorotateEnabled);
  131. localStorage.setItem(AUTOROTATE_KEY, Number(!autorotateEnabled));
  132. });
  133. var backButton = document.getElementById("back");
  134. backButton.addEventListener("click", function () {
  135. history.back();
  136. });
  137. function handle360Icon(type, isInit) {
  138. vr360Button.setAttribute(
  139. "src",
  140. type ? "./skin/icon-360-1.png" : "./skin/icon-360.png"
  141. );
  142. if (krpano) {
  143. setTimeout(
  144. function () {
  145. krpano.set("autorotate.enabled", type);
  146. },
  147. isInit ? 500 : 0
  148. );
  149. }
  150. }
  151. // 音乐播放的暂停
  152. const audioDom = document.querySelector("#myAudio");
  153. const musicOpenDom = document.querySelector("#vr-musicOpen");
  154. const musicCloseDom = document.querySelector("#vr-musicClose");
  155. if (audioDom) {
  156. // 默认播放音频
  157. audioDom.play();
  158. audioDom.onended = function () {
  159. // 音频播放完毕
  160. musicOpenDom.style.display = "inline-block";
  161. musicCloseDom.style.display = "none";
  162. };
  163. }
  164. musicOpenDom.addEventListener("click", () => {
  165. audioDom.play();
  166. musicOpenDom.style.display = "none";
  167. musicCloseDom.style.display = "inline-block";
  168. });
  169. musicCloseDom.addEventListener("click", () => {
  170. audioDom.pause();
  171. musicOpenDom.style.display = "inline-block";
  172. musicCloseDom.style.display = "none";
  173. });
  174. </script>
  175. </div>
  176. <!-- <script>
  177. function sendPost(value) {
  178. var iframeWin = document.getElementById("pano").contentWindow;
  179. iframeWin.postMessage(value,'http://localhost:8081/#/panorama?id=start')
  180. }
  181. </script> -->
  182. </body>
  183. </html>