手机tribe.html,index.html

首页

部落

(function() {

mui.init({

swipeBack: true //启用右滑关闭功能

});

//取消浏览器的所有事件,使得active的样式在手机上正常生效

document.addEventListener('touchstart', function() {

return false;

}, true);

// 禁止选择

document.oncontextmenu = function() {

return false;

};

mui.plusReady(function() {

// 隐藏滚动条

plus.webview.currentWebview().setStyle({

scrollIndicator: 'none'

});

var self = plus.webview.currentWebview(),

// 创建子webview窗口 并初始化

aniShow = {};

util.initSubpage(aniShow);

var nviews = plus.nativeObj.View.getViewById('tabBar'),

activePage = plus.webview.currentWebview(),

targetPage,

subpages = util.options.subpages,

pageW = window.innerWidth,

currIndex = 0;

/**

* 根据判断view控件点击位置判断切换的tab

*/

nviews.addEventListener('click', function(e) {

var clientX = e.clientX;

if(clientX > 0 && clientX <= parseInt(pageW * 0.25)) {

currIndex = 0;

} else if(clientX > parseInt(pageW * 0.25) && clientX <= parseInt(pageW * 0.5)) {

currIndex = 1;

} else if(clientX > parseInt(pageW * 0.5) && clientX <= parseInt(pageW * 0.75)) {

currIndex = 2;

} else {

currIndex = 3;

}

// 匹配对应tab窗口

if(currIndex > 0) {

targetPage = plus.webview.getWebviewById(subpages[currIndex - 1]);

} else {

targetPage = plus.webview.currentWebview();

}

if(targetPage == activePage) {

return;

}

//底部选项卡切换

util.toggleNview(currIndex);

// 子页面切换

util.changeSubpage(targetPage, activePage, aniShow);

//更新当前活跃的页面

activePage = targetPage;

});

});

})();

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值