tab-top-webview-main.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Hello MUI</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" href="../css/mui.min.css">
  10. <style>
  11. html,
  12. body {
  13. background-color: #efeff4;
  14. }
  15. .mui-bar~.mui-content .mui-fullscreen {
  16. top: 44px;
  17. height: auto;
  18. }
  19. .mui-pull-top-tips {
  20. position: absolute;
  21. top: -20px;
  22. left: 50%;
  23. margin-left: -25px;
  24. width: 40px;
  25. height: 40px;
  26. border-radius: 100%;
  27. z-index: 1;
  28. }
  29. .mui-bar~.mui-pull-top-tips {
  30. top: 24px;
  31. }
  32. .mui-pull-top-wrapper {
  33. width: 42px;
  34. height: 42px;
  35. display: block;
  36. text-align: center;
  37. background-color: #efeff4;
  38. border: 1px solid #ddd;
  39. border-radius: 25px;
  40. background-clip: padding-box;
  41. box-shadow: 0 4px 10px #bbb;
  42. overflow: hidden;
  43. }
  44. .mui-pull-top-tips.mui-transitioning {
  45. -webkit-transition-duration: 200ms;
  46. transition-duration: 200ms;
  47. }
  48. .mui-pull-top-tips .mui-pull-loading {
  49. /*-webkit-backface-visibility: hidden;
  50. -webkit-transition-duration: 400ms;
  51. transition-duration: 400ms;*/
  52. margin: 0;
  53. }
  54. .mui-pull-top-wrapper .mui-icon,
  55. .mui-pull-top-wrapper .mui-spinner {
  56. margin-top: 7px;
  57. }
  58. .mui-pull-top-wrapper .mui-icon.mui-reverse {
  59. /*-webkit-transform: rotate(180deg) translateZ(0);*/
  60. }
  61. .mui-pull-bottom-tips {
  62. text-align: center;
  63. background-color: #efeff4;
  64. font-size: 15px;
  65. line-height: 40px;
  66. color: #777;
  67. }
  68. .mui-pull-top-canvas {
  69. overflow: hidden;
  70. background-color: #fafafa;
  71. border-radius: 40px;
  72. box-shadow: 0 4px 10px #bbb;
  73. width: 40px;
  74. height: 40px;
  75. margin: 0 auto;
  76. }
  77. .mui-pull-top-canvas canvas {
  78. width: 40px;
  79. }
  80. .mui-slider-indicator.mui-segmented-control {
  81. background-color: #efeff4;
  82. }
  83. </style>
  84. </head>
  85. <body>
  86. <header class="mui-bar mui-bar-nav">
  87. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  88. <h1 class="mui-title">顶部选项卡-可左右拖动(webview)</h1>
  89. </header>
  90. <div class="mui-content">
  91. <div id="slider" class="mui-slider mui-fullscreen">
  92. <div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
  93. <div class="mui-scroll">
  94. <a class="mui-control-item mui-active" href="#item1mobile" data-wid="tab-top-subpage-1.html">
  95. 推荐
  96. </a>
  97. <a class="mui-control-item" href="#item2mobile" data-wid="tab-top-subpage-2.html">
  98. 热点
  99. </a>
  100. <a class="mui-control-item" href="#item3mobile" data-wid="tab-top-subpage-3.html">
  101. 北京
  102. </a>
  103. <a class="mui-control-item" href="#item4mobile" data-wid="tab-top-subpage-4.html">
  104. 社会
  105. </a>
  106. <a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">
  107. 娱乐
  108. </a>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <script src="../js/mui.min.js"></script>
  114. <script src="../js/webviewGroup.js" type="text/javascript" charset="utf-8"></script>
  115. <script>
  116. mui.init();
  117. mui.plusReady(function() {
  118. var _self = plus.webview.currentWebview();
  119. var group = new webviewGroup(_self.id, {
  120. items: [{
  121. id: "tab-top-subpage-1.html",
  122. url: "tab-top-subpage-1.html",
  123. extras: {}
  124. }, {
  125. id: "tab-top-subpage-2.html",
  126. url: "tab-top-subpage-2.html",
  127. extras: {}
  128. }, {
  129. id: "tab-top-subpage-3.html",
  130. url: "tab-top-subpage-3.html",
  131. extras: {}
  132. }, {
  133. id: "tab-top-subpage-4.html",
  134. url: "tab-top-subpage-4.html",
  135. extras: {}
  136. }, {
  137. id: "tab-top-subpage-5.html",
  138. url: "tab-top-subpage-5.html",
  139. extras: {}
  140. }],
  141. onChange: function(obj) {
  142. var c = document.querySelector(".mui-control-item.mui-active");
  143. if(c) {
  144. c.classList.remove("mui-active");
  145. }
  146. var target = document.querySelector(".mui-scroll .mui-control-item:nth-child(" + (parseInt(obj.index) + 1) + ")");
  147. target.classList.add("mui-active");
  148. if(target.scrollIntoView) {
  149. target.scrollIntoView();
  150. }
  151. }
  152. });
  153. mui(".mui-scroll").on("tap", ".mui-control-item", function(e) {
  154. var wid = this.getAttribute("data-wid");
  155. group.switchTab(wid);
  156. });
  157. });
  158. mui.back = function() {
  159. var _self = plus.webview.currentWebview();
  160. _self.close("auto");
  161. }
  162. </script>
  163. </body>
  164. </html>