index.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>答题游戏</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link rel="stylesheet" href="css/index.css">
  8. </head>
  9. <body>
  10. <!-- 等待页 -->
  11. <section class="waitting full" id="load">
  12. <div class="loader-inner pacman">
  13. <div></div>
  14. <div></div>
  15. <div></div>
  16. <div></div>
  17. <div></div>
  18. <p class="wait-text">正在等待他人加入,请勿关闭...</p>
  19. </div>
  20. </section>
  21. <div class="all">
  22. <!-- 背景 -->
  23. <section class="bg full"></section>
  24. <p class="ren-text">剩余:<span id="ren">0</span>人</p>
  25. <!-- 人物 -->
  26. <section class="full">
  27. <div class="line l2"></div>
  28. <div class="line l3"></div>
  29. <div class="box" id="figureBox"></div>
  30. </section>
  31. <!-- 陷阱-->
  32. <section class="trapbox full" id="trapID">
  33. <div class="trap "></div>
  34. <div class="trap"></div>
  35. </section>
  36. <section class="full" id="go">
  37. <!-- 倒计时 -->
  38. <section class="time"><span id="countDown">30</span></section>
  39. <!-- 问题框 -->
  40. <section class="question-box">
  41. <div class="question" id="ques"></div>
  42. <div class="text"><span id="num">1</span>/<span id="allQues">15</span></div>
  43. </section>
  44. <!-- 答题框 -->
  45. <section class="answer-box" id="ansBox">
  46. <div class="ans ans-1" data-id="0">A</div>
  47. <div class="ans ans-3" data-id="2">B</div>
  48. </section>
  49. </section>
  50. <section class="time-box"></section>
  51. </div>
  52. <!--静音按钮-->
  53. <dl class="mute">
  54. <dt></dt>
  55. <dd id="mp3"></dd>
  56. <audio id="music" preload="auto" src="img/bg.mp3" loop="loop"></audio>
  57. </dl>
  58. <script src="js/jquery.js"></script>
  59. <script src="js/jquery.transit.min.js"></script>
  60. <script>
  61. document.addEventListener('DOMContentLoaded', function() {
  62. function audioAutoPlay(id) {
  63. var audio = document.getElementById(id);
  64. audio.play();
  65. document.addEventListener("WeixinJSBridgeReady", function() {
  66. audio.play();
  67. }, false);
  68. audio.onended = function() {
  69. if (audio.id == 'music') {
  70. audio.play();
  71. } else {
  72. audio.pause();
  73. return
  74. }
  75. }
  76. }
  77. function audioPause(id) {
  78. var audio = document.getElementById(id);
  79. audio.pause();
  80. document.addEventListener("WeixinJSBridgeReady", function() {
  81. audio.pause();
  82. }, false);
  83. }
  84. audioAutoPlay('music');
  85. gv={};
  86. gv.isTouch = window.ontouchstart === undefined ? false : true;
  87. gv.evtDown = gv.isTouch ? "touchstart" : "mousedown";
  88. $(".mute").on(gv.evtDown, function() {
  89. $(this).toggleClass('on')
  90. if ($(this).hasClass('on')) {
  91. audioPause('music');
  92. } else {
  93. audioAutoPlay('music');
  94. }
  95. })
  96. })
  97. </script>
  98. <script src="js/game.js?V=2022"></script>
  99. </body>
  100. </html>