tour2.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. // 塑像默认开启巡视
  110. if (location.href.indexOf("statue") > -1) {
  111. handle360Icon(true, true);
  112. } else {
  113. handle360Icon(
  114. Boolean(Number(localStorage.getItem(AUTOROTATE_KEY))),
  115. true
  116. );
  117. }
  118. },
  119. });
  120. var homeButton = document.getElementById("vr-home");
  121. homeButton.addEventListener("click", function () {
  122. window.parent.postMessage(
  123. {
  124. openPopup: true,
  125. },
  126. "*"
  127. );
  128. });
  129. // var vrButton = document.getElementById("vr-icon");
  130. // vrButton.addEventListener("click", function () {
  131. // if (krpano) krpano.call("webvr.enterVR();");
  132. // });
  133. vr360Button.addEventListener("click", function () {
  134. var autorotateEnabled = krpano.get("autorotate.enabled");
  135. handle360Icon(!autorotateEnabled);
  136. localStorage.setItem(AUTOROTATE_KEY, Number(!autorotateEnabled));
  137. });
  138. var backButton = document.getElementById("back");
  139. backButton.addEventListener("click", function () {
  140. location.href = "./tour.html";
  141. });
  142. function handle360Icon(type, isInit) {
  143. vr360Button.setAttribute(
  144. "src",
  145. type ? "./skin/icon-360-1.png" : "./skin/icon-360.png"
  146. );
  147. if (krpano) {
  148. setTimeout(
  149. function () {
  150. krpano.set("autorotate.enabled", type);
  151. },
  152. isInit ? 500 : 0
  153. );
  154. }
  155. }
  156. // 音乐播放的暂停
  157. const audioDom = document.querySelector("#myAudio");
  158. const musicOpenDom = document.querySelector("#vr-musicOpen");
  159. const musicCloseDom = document.querySelector("#vr-musicClose");
  160. if (audioDom) {
  161. // 默认播放音频
  162. audioDom.play();
  163. audioDom.onended = function () {
  164. // 音频播放完毕
  165. musicOpenDom.style.display = "inline-block";
  166. musicCloseDom.style.display = "none";
  167. };
  168. }
  169. musicOpenDom.addEventListener("click", () => {
  170. audioDom.play();
  171. musicOpenDom.style.display = "none";
  172. musicCloseDom.style.display = "inline-block";
  173. });
  174. musicCloseDom.addEventListener("click", () => {
  175. audioDom.pause();
  176. musicOpenDom.style.display = "inline-block";
  177. musicCloseDom.style.display = "none";
  178. });
  179. </script>
  180. </div>
  181. <!-- <script>
  182. function sendPost(value) {
  183. var iframeWin = document.getElementById("pano").contentWindow;
  184. iframeWin.postMessage(value,'http://localhost:8081/#/panorama?id=start')
  185. }
  186. </script> -->
  187. </body>
  188. </html>