MUI开发app时,为什么我的tap事件总是没有效果(注:document.getelementbyid("personcentera")有值)
<!DOCTYPEhtml><html><head><metacharset="utf-8"><title></title><scripttype="text/javas...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet"/>
<script type="text/javascript" charset="utf-8">
mui.init(
{
gestureConfig:{
tap: true, //默认为true
doubletap: true, //默认为false
longtap: false, //默认为false
swipe: true, //默认为true
drag: true, //默认为true
hold:false, //默认为false,不监听
release:false //默认为false,不监听
}
}
);
</script>
</head>
<body>
<div id="home">
<div data-iconpos="notext" data-transition="fade" data-position="fixed">
<h1>物流宝</h1>
</div>
<div>
<table width="392" height="437" border="0">
<tr> <img src="images/fahuo_1.jpg" border="0" width="392px" usemap="#Map"/> </tr>
<tr>
<td width="196px" height="117px"><a href="xlyj.html"><img src="images/fahuo_2.jpg" alt="yj" width="195px" height="117px" border="0"></a></td>
<td width="196px" rowspan="2"><a href="ydbj.html"><img src="images/fahuo_5.jpg" alt="yd" width="196px" height="199px" border="0"></a></td>
</tr>
<tr>
<td width="196px" rowspan="2"><a href="fhlb.html"><img src="images/fahuo_3.jpg" alt="fh" width="195px" height="199px" border="0"></a></td>
</tr>
<tr>
<td height="117px"><a><img id="personcentera" src="images/fahuo_6.jpg" alt="ge" width="195px" height="117px" border="0" /></a></td>
</tr>
<tr>
<td height="117px"><a href="#"><img src="images/fahuo_4.jpg" alt="kf" width="195px" height="119px" border="0"></a></td>
<td><a href="#"><img src="images/fahuo_7.jpg" alt="xx" width="196px" height="119px" border="0"></a></td>
</tr>
</table>
</div>
<div>
<p class="copyright">Copyright 2015<a href=#" target="_blank">天堂公司所有</a>All rights reserved.</p>
</div>
</div>
</body>
</html>
<script>
document.getElementById('personcentera').addEventListener('tap',function(){
console.log('hello');
});
</script>
这里只写了一个tap单击事件,我找不到原因
mui是目前最新的1.8.0 展开
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet"/>
<script type="text/javascript" charset="utf-8">
mui.init(
{
gestureConfig:{
tap: true, //默认为true
doubletap: true, //默认为false
longtap: false, //默认为false
swipe: true, //默认为true
drag: true, //默认为true
hold:false, //默认为false,不监听
release:false //默认为false,不监听
}
}
);
</script>
</head>
<body>
<div id="home">
<div data-iconpos="notext" data-transition="fade" data-position="fixed">
<h1>物流宝</h1>
</div>
<div>
<table width="392" height="437" border="0">
<tr> <img src="images/fahuo_1.jpg" border="0" width="392px" usemap="#Map"/> </tr>
<tr>
<td width="196px" height="117px"><a href="xlyj.html"><img src="images/fahuo_2.jpg" alt="yj" width="195px" height="117px" border="0"></a></td>
<td width="196px" rowspan="2"><a href="ydbj.html"><img src="images/fahuo_5.jpg" alt="yd" width="196px" height="199px" border="0"></a></td>
</tr>
<tr>
<td width="196px" rowspan="2"><a href="fhlb.html"><img src="images/fahuo_3.jpg" alt="fh" width="195px" height="199px" border="0"></a></td>
</tr>
<tr>
<td height="117px"><a><img id="personcentera" src="images/fahuo_6.jpg" alt="ge" width="195px" height="117px" border="0" /></a></td>
</tr>
<tr>
<td height="117px"><a href="#"><img src="images/fahuo_4.jpg" alt="kf" width="195px" height="119px" border="0"></a></td>
<td><a href="#"><img src="images/fahuo_7.jpg" alt="xx" width="196px" height="119px" border="0"></a></td>
</tr>
</table>
</div>
<div>
<p class="copyright">Copyright 2015<a href=#" target="_blank">天堂公司所有</a>All rights reserved.</p>
</div>
</div>
</body>
</html>
<script>
document.getElementById('personcentera').addEventListener('tap',function(){
console.log('hello');
});
</script>
这里只写了一个tap单击事件,我找不到原因
mui是目前最新的1.8.0 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
展开全部
你是在浏览器中使用?还是打包生成app之后没有效果?
加上下面这段判断代码试一下
<script>
mui.init();
var ua = navigator.userAgent.toLowerCase();
var sys = ua.match(/html5plus/);
if (sys != 'html5plus') {
mui.openWindow = function openWindow(param, target, options) {
if (param.target == '_blank') {
window.open(param.url);
} else {
window.location.href = param.url;
}
}
}
//在此处编写绑定的top事件即可
</script>
加上下面这段判断代码试一下
<script>
mui.init();
var ua = navigator.userAgent.toLowerCase();
var sys = ua.match(/html5plus/);
if (sys != 'html5plus') {
mui.openWindow = function openWindow(param, target, options) {
if (param.target == '_blank') {
window.open(param.url);
} else {
window.location.href = param.url;
}
}
}
//在此处编写绑定的top事件即可
</script>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询