刚刚没发现图挂了。。。这里不能传本地图,我就直接发链接吧
这是手机上的截图http://imgsrc.baidu.com/forum/pic/item/5e00972a2834349b46531023ceea15ce37d3bee8.jpg
我想要的效果是这样的http://imgsrc.baidu.com/forum/pic/item/cfa2cf5494eef01fbf6e6163e7fe9925bd317dcf.jpg
下面是两个页面的代码
父页面
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<script src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet"/>
<script type="text/javascript" charset="UTF-8">
mui.init({
subpages:[{
url:"index.html",
styles:{
top:"44px",
bottom:"44px"
}
}]
});
</script>
</head>
<body>
<div class="mui-off-canvas-wrap mui-draggable">
<div class="mui-inner-wrap">
<aside class="mui-off-canvas-left">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view">
<li class="mui-table-view-cell mui-active">link1</li>
<li class="mui-table-view-cell">link2</li>
</ul>
</div>
</div>
</aside>
<header class="mui-bar mui-bar-nav">
<span class="mui-icon mui-icon-bars mui-active" id="menu-switch"></span>
<h1 class="mui-title">Title</h1>
</header>
<nav class="mui-bar mui-bar-tab">
<a class="mui-tab-item">
<span class="mui-icon mui-icon-home"></span>
<span class="mui-tab-label">Home</span>
</a>
<a class="mui-tab-item">
<span class="mui-icon mui-icon-contact"></span>
<span class="mui-tab-label">Info</span>
</a>
</nav>
</div>
</div>
<script>
var menuSwitch = document.getElementById("menu-switch");
//监听左滑菜单按钮
menuSwitch.addEventListener("tap",function(){
mui(".mui-off-canvas-left").offCanvas("show");
});
</script>
</body>
</html>
子页面
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<script src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet"/>
<link rel="icon" href="images/1.ico" />
<script type="text/javascript" charset="utf-8">
mui.init();
</script>
</head>
<body>
<div class="mui-content mui-scroll-wrapper">
<div class="mui-scroll">
<div class="mui-slider">
<div class="mui-slider-group mui-slider-loop" id="gallery-group"></div>
<div class="mui-slider-indicator" id="gallery-indicator"></div>
</div>
</div>
</div>
<script>
var falseData = {};
falseData.imgSrc = ["images/1.jpg","images/2.jpg","images/3.jpg"];
gallery(falseData.imgSrc);
function gallery(imgArr){
/*渲染轮播组件*/
var galleryGroup = document.getElementById("gallery-group"),
galleryIndicator = document.getElementById("gallery-indicator"),
groupContent = "",
indicatorContent = "",
aux= [];//占位图片
aux.push("<div class='mui-slider-item mui-slider-item-duplicate'><a><img src='"+imgArr[imgArr.length-1]+"'/></a></div>");
aux.push("<div class='mui-slider-item mui-slider-item-duplicate'><a><img src='"+imgArr[0]+"'/></a></div>");
groupContent = aux[0]+"<div class='mui-slider-item'><a><img src='"+imgArr.join("'/></a></div><div class='mui-slider-item'><a><img src='")+"'/></a></div>"+aux[1];
for(var i=0,j=imgArr.length;i<j;i++){
if(i===0){
indicatorContent +="<div class='mui-indicator mui-active'></div>";
continue;
}
indicatorContent +="<div class='mui-indicator'></div>";
}
galleryGroup.innerHTML = groupContent;
galleryIndicator.innerHTML = indicatorContent;
mui(".mui-slider").slider({
interval:1000
});
}
mui.plusReady(function(){
plus.key.addEventListener("backbutton",function(){
plus.runtime.quit();
})
})
</script>
</body>
</html>
4 个回复
马脸老男人 - Bazinga!
主页面:
马脸老男人 - Bazinga!
子页面:
马脸老男人 - Bazinga!
侧滑页面:
wodertian (作者)
额,我刚刚用另外一种思路解决了,等下回家再看下你的方法,先谢谢了
2016-04-07 18:06
马脸老男人
你可以把你的代码也贴出来吗?
2016-04-07 18:09
马脸老男人 - Bazinga!
刚在整理的时候又发现了一个问题:主页面要放在App首页,如果主页面不是App首页的话,记得在App首页的mui.init里加段代码,具体如下:
马脸老男人
加这段代码还是有问题,目前只能放在首页,实在抱歉!
2016-04-08 10:57