CreateHtml.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * 说明:创建页面元素
  3. */
  4. function createHtml() {
  5. let sign =
  6. `<div id="all-controls">
  7. <div class="controls">
  8. <a id="horizontalExpansion" class="control-item">
  9. <i class="btn-horizontal"></i>
  10. <span class="tooltiptext">横向展开</span>
  11. </a>
  12. <a id="verticalExpansion" class="control-item">
  13. <i class="btn-vertical"></i>
  14. <span class="tooltiptext">纵向展开</span>
  15. </a>
  16. <a id="moveByFps" class="control-item">
  17. <i class="btn-fps"></i>
  18. <span class="tooltiptext">第一人称行走</span>
  19. </a>
  20. <a id="miniMap" class="control-item">
  21. <i class="btn-map"></i>
  22. <span class="tooltiptext">小地图</span>
  23. </a>
  24. <a id="sceneSetting" class="control-item">
  25. <i class="btn-setting"></i>
  26. <span class="tooltiptext">设置</span>
  27. <div class="control-menu map-bg-select-menu">
  28. <div class="control-menu-wrapper" style="position: relative">
  29. <div class="control-menu-pane">
  30. <ul class="setting-list">
  31. <li class="autoRotate setting-item selected">自动旋转</li>
  32. </ul>
  33. </div>
  34. </div>
  35. </div>
  36. </a>
  37. <a id="fullScreen" class="control-item">
  38. <i class="btn-full-screen"></i>
  39. <i class="btn-narrow"></i>
  40. <span class="tooltiptext">全屏</span>
  41. </a>
  42. </div>
  43. </div>`;
  44. // 将页面元素加入到div2d容器中,相关示例可参考官方示例-->界面2D-->UIAnchor
  45. $('#div2d').append($(sign));
  46. registerEvent(); // 注册事件
  47. }