您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.html 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. <script src="./jquery.min.js"></script>
  10. <script src="./jquery.accordion.js"></script>
  11. <style>
  12. * {
  13. margin: 0;
  14. padding: 0;
  15. }
  16. html,
  17. body {
  18. width: 100%;
  19. height: 100%;
  20. overflow: hidden;
  21. }
  22. .container{
  23. display: flex;
  24. height: 100%;
  25. }
  26. .example-list::-webkit-scrollbar{
  27. width:10px;
  28. height:10px;
  29. /**/
  30. }
  31. .example-list::-webkit-scrollbar-track{
  32. background: #424242;
  33. }
  34. .example-list::-webkit-scrollbar-thumb{
  35. background: #686868;
  36. max-height: 20px;
  37. }
  38. .nav{
  39. width: 300px;
  40. height: 100%;
  41. overflow: hidden;
  42. background: #222;
  43. color: #fff;
  44. display: flex;
  45. flex-direction: column;
  46. }
  47. .example{
  48. flex: 1;
  49. height: 100%;
  50. overflow: hidden;
  51. }
  52. iframe{
  53. width: 100%;
  54. height: 100%;
  55. overflow: hidden;
  56. }
  57. .nav .banner{
  58. padding: 20px 20px 0 20px;
  59. color:#1e80ff;
  60. font-weight: bold;
  61. font-style: italic;
  62. }
  63. .example-list-wrapper{
  64. flex: 1;
  65. overflow: hidden;
  66. user-select: none;
  67. margin-top: 15px;
  68. display: flex;
  69. flex-direction: column;
  70. }
  71. .example-list{
  72. flex: 1;
  73. overflow: hidden;
  74. overflow-y: auto;
  75. }
  76. .example-list-wrapper .desc{
  77. height: 150px;
  78. }
  79. .example-list .example-item{
  80. border-top: 1px solid #444 ;
  81. padding: 10px 0;
  82. }
  83. .example-list h4{
  84. padding-left: 20px;
  85. margin: 10px 0;
  86. color: #bcbcbc;
  87. }
  88. .example-list h4:hover,.example-list ul li:hover{
  89. cursor: pointer;
  90. }
  91. .example-list ul{
  92. padding-left: 35px;
  93. list-style: none;
  94. }
  95. .example-list ul li{
  96. margin: 10px 0;
  97. font-size: 15px;
  98. }
  99. .example-list ul li:hover a,.example-list ul li.active a{
  100. color: #1e80ff;
  101. }
  102. .example-list ul li:hover,.example-list ul li a{
  103. color: #fff;
  104. text-decoration: none;
  105. }
  106. #code-link{
  107. position: fixed;
  108. bottom: 16px;
  109. left: 320px;
  110. padding: 8px;
  111. border-radius: 50%;
  112. margin-bottom: 0;
  113. background-color: #FFF;
  114. opacity: .9;
  115. z-index: 999;
  116. box-shadow: 0 0 4px rgba(0,0,0,.15);
  117. display: flex;
  118. }
  119. #code-link img{
  120. width: 30px;
  121. }
  122. </style>
  123. </head>
  124. <body>
  125. <div class="container">
  126. <div class="nav">
  127. <div class="banner"> DC-SDK v3.0.0 </div>
  128. <div class="example-list-wrapper">
  129. <div id="example-list" class="example-list" data-accordion-group> </div>
  130. <div class="desc"></div>
  131. </div>
  132. </div>
  133. <div class="example">
  134. <iframe id="inner-page" name="inner-page" style="border: 0" allow="fullscreen; xr-spatial-tracking;"></iframe>
  135. <a id="code-link" href="" target="_blank"><img src="./assets/icon/code.svg" title="源码" alt=“”></a>
  136. </div>
  137. <script src="./list.js"></script>
  138. <script type="text/javascript">
  139. $(document).ready(function() {
  140. let href =undefined
  141. let $currentPage = undefined
  142. if(window.location.href.indexOf("#")> -1){
  143. let hrefArr = window.location.href.split('#')
  144. if(hrefArr[1]){
  145. href = hrefArr[1].replace('_','/')
  146. }
  147. $('#code-link').attr('href','https://github.com/dvgis/dc-sdk/blob/master/examples/'+href)
  148. }
  149. $('#inner-page').attr('src',href || 'info/start.html')
  150. EXAMPLE_LIST.forEach(item => {
  151. let $section = $('<div data-accordion ></div>')
  152. $section.addClass('example-item')
  153. let $title = $('<h4 data-control ></h4>').text(item.name)
  154. $title.appendTo($section)
  155. let $pageWrapper= $('<ul data-content></ul>')
  156. $pageWrapper.appendTo($section)
  157. if(item.children){
  158. item.children.forEach(child => {
  159. let $page = $('<li></li>')
  160. let $link = $('<a></a>').text(child.name)
  161. $link.attr('href',item.folder+'/'+child.page).attr('target','inner-page')
  162. $link.bind('click',e=>{
  163. if($currentPage){
  164. $currentPage.removeClass('active')
  165. }
  166. window.location.href = window.location.href.replace(/#\w*\.?\w*/g,'') +'#'+ item.folder+ '_'+child.page
  167. $page.addClass('active')
  168. $('#code-link').attr('href','https://github.com/dvgis/dc-sdk/blob/master/examples/'+item.folder +'/'+child.page)
  169. $currentPage =$page
  170. })
  171. $page.append($link)
  172. $pageWrapper.append($page)
  173. })
  174. }
  175. $section.appendTo($('#example-list'))
  176. })
  177. $('#example-list [data-accordion]').accordion();
  178. });
  179. </script>
  180. </div>
  181. </body>
  182. </html>