帖子
帖子
用户
博客
课程
显示全部楼层
1682
帖子
10
勋章
Y币

MNNavigationMenu模块(导航菜单)demo示例

  [复制链接]
发表于 2017-8-1 14:29:04
MNNavigationMenu 是一个导航栏菜单,开发者可自定义其中的样式和按钮个数,超出屏幕部分可左右拖动查看。

点击进入模块详情

index.html
  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.     <style type="text/css">
  8.             html{ background-color: white; }
  9.         header{ border-bottom: 1px solid #ccc; padding: 25px 0; }
  10.         span {
  11.             padding: 10px 15px;
  12.             margin: 10px;
  13.             display: inline-block;
  14.             background-color: #e8e8e8;
  15.         }
  16.         .hover{ opacity: .4; }
  17.     </style>
  18. </head>
  19. <body>
  20.     <header>
  21.         <h1>MNNavigationMenu</h1>
  22.         <mark>
  23.             使用前请详细阅读 文档 使用规则
  24.         </mark>
  25.     </header>
  26.     <span tapmode="hover" onclick="fnOpen()">open</span>
  27.     <span tapmode="hover" onclick="fnSetIndex()">setIndex</span>
  28.     <span tapmode="hover" onclick="fnClose()">close</span>
  29.     <span tapmode="hover" onclick="fnShow()">show</span>
  30.     <span tapmode="hover" onclick="fnHide()">hide</span>
  31. </body>
  32. <script type="text/javascript">
  33.     var MNNavigationMenu;
  34.     apiready = function() {
  35.         MNNavigationMenu = api.require('MNNavigationMenu');
  36.     };
  37.     function fnOpen(){
  38.         MNNavigationMenu.open({
  39.             rect: {
  40.                 x: 0,
  41.                 y: 0,
  42.                 w: api.winWidth,
  43.                 h: 44
  44.             },
  45.             index: 0,
  46.             animation: true,
  47.             styles: {
  48.                 column: 4,
  49.                 bg: '#eee',
  50.                 item: {
  51.                     width: api.winWidth / 4,
  52.                     bg: '#eee',
  53.                     active: '#eee',
  54.                     highlight: '#eee',
  55.                     title: {
  56.                         marginB: 6,
  57.                         size: 14,
  58.                         height: 44,
  59.                         color: '#888',
  60.                         active: '#f00',
  61.                         highlight: '#f00'
  62.                     }
  63.                 }
  64.             },
  65.             items: [{
  66.                 title: '菜单项0'
  67.             }, {
  68.                 title: '菜单项1'
  69.             }, {
  70.                 title: '菜单项2'
  71.             }, {
  72.                 title: '菜单项3'
  73.             }, {
  74.                 title: '菜单项4'
  75.             }, {
  76.                 title: '菜单项5'
  77.             }, {
  78.                 title: '菜单项6'
  79.             }],
  80.             fixed: false
  81.         }, function(ret, err) {
  82.             if (ret) {
  83.                 alert(JSON.stringify(ret));
  84.             } else {
  85.                 alert(JSON.stringify(err));
  86.             }
  87.         });
  88.     }
  89.     function fnSetIndex(){
  90.         MNNavigationMenu.setIndex({
  91.             index: 3
  92.         }, function(ret, err) {
  93.             if (ret) {
  94.                 alert(JSON.stringify(ret));
  95.             } else {
  96.                 alert(JSON.stringify(err));
  97.             }
  98.         });
  99.     }
  100.     function fnClose(){
  101.         MNNavigationMenu.close();
  102.     }
  103.     function fnShow(){
  104.         MNNavigationMenu.show();
  105.     }
  106.     function fnHide(){
  107.         MNNavigationMenu.hide();
  108.     }
  109.    
  110. </script>
  111. </html>
复制代码



config.xml
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <widget id="A0000000000001"  version="0.0.1">
  3.     <name>MNNavigationMenu</name>
  4.     <description>
  5.         Example For APICloud.
  6.     </description>
  7.     <author email="developer@apicloud.com" href="http://www.apicloud.com">
  8.         Developer
  9.     </author>
  10.     <content src="index.html" />
  11.     <access origin="*" />
  12.     <preference name="pageBounce" value="false"/>
  13.         <preference name="appBackground" value="rgba(0,0,0,0.0)"/>
  14.         <preference name="windowBackground" value="rgba(0,0,0,0.0)"/>
  15.         <preference name="frameBackgroundColor" value="rgba(0,0,0,0.0)"/>
  16.         <preference name="hScrollBarEnabled" value="true"/>
  17.         <preference name="vScrollBarEnabled" value="true"/>
  18.         <preference name="autoLaunch" value="true"/>
  19.         <preference name="fullScreen" value="false"/>
  20.         <preference name="autoUpdate" value="true" />
  21.         <preference name="smartUpdate" value="false" />
  22.         <preference name="debug" value="true"/>
  23.         <preference name="statusBarAppearance" value="true"/>
  24.         <permission name="readPhoneState" />
  25.         <permission name="camera" />
  26.         <permission name="record" />
  27.         <permission name="location" />
  28.         <permission name="fileSystem" />
  29.         <permission name="internet" />
  30.         <permission name="bootCompleted" />
  31.         <permission name="hardware" />
  32. </widget>
复制代码


5
帖子
0
勋章
417
Y币
回帖拿金币,支持支持
0
帖子
0
勋章
49
Y币
这个和NVNavigationBar有什么不同?
16
帖子
1
勋章
1699
Y币
回帖拿金币,支持支持
99
帖子
1
勋章
314
Y币
回帖拿金币,支持支持
75
帖子
0
勋章
822
Y币
支持一下,拿云币
136
帖子
1
勋章
853
Y币
捡个云币
258
帖子
4
勋章
1024
Y币

回帖拿金币,支持支持
8
帖子
0
勋章
82
Y币

帖拿金币,支持支持
25
帖子
0
勋章
188
Y币
帖拿金币,支持支持
12345678910... 14下一页
您需要登录后才可以回帖 登录

本版积分规则