index.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>底部导航</title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="../../css/style.css" />
  10. <style>
  11. header{ background-color: #f2f2f2; }
  12. header ul li { height: 50px; line-height: 50px; text-align: center; display: none; color: #323237; position: relative;font-size: 18px; }
  13. header ul li.active{ display: block; }
  14. #footer ul li.active{ color: #D9251C; }
  15. #footer ul li:nth-child(1){ background-image: url(../../image/bottombtn0101.png); }
  16. #footer ul li:nth-child(2){ background-image: url(../../image/bottombtn0201.png); }
  17. #footer ul li:nth-child(3){ background-image: url(../../image/bottombtn0401.png); }
  18. #footer ul li:nth-child(1).active{ background-image: url(../../image/bottombtn0102.png); }
  19. #footer ul li:nth-child(2).active{ background-image: url(../../image/bottombtn0202.png); }
  20. #footer ul li:nth-child(3).active{ background-image: url(../../image/bottombtn0402.png); }
  21. .flex-con{
  22. overflow: auto
  23. }
  24. </style>
  25. <script>
  26. (function(w, d, m) {
  27. function r() {
  28. var t = 100,
  29. o = 750,
  30. e = d.documentElement.clientWidth || w.innerWidth,
  31. n = m.max(m.min(e, 480), 320),
  32. h = 50;
  33. 320 >= n && (h = m.floor(n / o * t * .99)),
  34. n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
  35. n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
  36. n > 375 && (h = m.floor(n / o * t * .97)),
  37. d.querySelector("html").style.fontSize = h + "px"
  38. };
  39. r();
  40. w.onresize = function() {
  41. r()
  42. }
  43. })(window, document, Math);
  44. </script>
  45. </head>
  46. <body>
  47. <div id="wrap" class="flex-wrap flex-vertical">
  48. <header style="display: none;">
  49. <ul>
  50. <li class="border-b active"></li>
  51. <li class="border-b"></li>
  52. <li class="border-b"></li>
  53. </ul>
  54. </header>
  55. <div id="main" class="flex-con">
  56. </div>
  57. <div id="footer" class="border-t">
  58. <ul class="flex-wrap">
  59. <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con active">首页</li>
  60. <!-- <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">订单</li> -->
  61. <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">我的</li>
  62. </ul>
  63. </div>
  64. </div>
  65. </body>
  66. </html>
  67. <script type="text/javascript" src="../../script/api.js"></script>
  68. <script type="text/javascript">
  69. apiready = function() {
  70. $api.fixStatusBar($api.dom('header'));
  71. api.setStatusBarStyle({
  72. style: 'dark',
  73. color: '#fff'
  74. });
  75. funIniGroup();
  76. setBackDisable();
  77. //$api.setStorage("storeid",2);
  78. }
  79. function funIniGroup() {
  80. var eHeaderLis = $api.domAll('header li'),
  81. frames = [];
  82. for (var i = 0, len = eHeaderLis.length; i < len; i++) {
  83. frames.push({
  84. name: 'frame' + i,
  85. url: './frame' + i + '.html',
  86. bgColor: 'rgba(0,0,0,.2)',
  87. bounces: false,
  88. vScrollBarEnabled: false,
  89. hScrollBarEnabled: false,
  90. slidBackEnabled: false
  91. })
  92. }
  93. api.openFrameGroup({
  94. name: 'group',
  95. scrollEnabled: false,
  96. rect: {
  97. x: 0,
  98. y: $api.dom('header').offsetHeight,
  99. w: 'auto',//api.winWidth,
  100. h: 'auto'//$api.dom('#main').offsetHeight
  101. },
  102. index: 0,
  103. frames: frames
  104. }, function(ret, err) {
  105. });
  106. }
  107. function set_height() {
  108. api.setFrameGroupAttr({
  109. name: 'group',
  110. rect: {
  111. x: 0,
  112. y: $api.dom('header').offsetHeight,
  113. w: api.winWidth,
  114. h: $api.dom('#main').offsetHeight
  115. }
  116. })
  117. }
  118. // 随意切换按钮
  119. function randomSwitchBtn(tag) {
  120. if (tag == $api.dom('#footer li.active')) return;
  121. var eFootLis = $api.domAll('#footer li'),
  122. eHeaderLis = $api.domAll('header li'),
  123. index = 0;
  124. for (var i = 0, len = eFootLis.length; i < len; i++) {
  125. if (tag == eFootLis[i]) {
  126. index = i;
  127. } else {
  128. $api.removeCls(eFootLis[i], 'active');
  129. $api.removeCls(eHeaderLis[i], 'active');
  130. }
  131. }
  132. $api.addCls(eFootLis[index], 'active');
  133. $api.addCls(eHeaderLis[index], 'active');
  134. api.setFrameGroupIndex({
  135. name: 'group',
  136. index: index
  137. });
  138. }
  139. </script>