- $(function(){
- $("#index").on('tap', function() {
- window.location.href = '../index/index.html';
- });
- $("#classify").on('tap', function() {
- window.location.href = '../product/classify.html';
- });
- $("#vip").on('tap', function() {
- window.location.href = '../vip/vipCenter.html';
- });
- $("#shoppingCart").on('tap', function() {
- window.location.href = '../shopcart/shoppingcar.html';
- });
- $("#personal").on('tap', function() {
- window.location.href = '../personalCenter/index.html';
- });
- });
②:直接注释mui中,阻止a标签默认跳转的源码部分 (不到万不得已,一般不推荐直接修改或者注释源码)
③:当你想让某个页面的a标签跳转不受mui影响,但又不想使用上面2种方法时,可以在当前页面添加如下代码,亲测好用
mui(document).on('tap', 'a', function() {
var a = document.createElement('a');
a = this.cloneNode(true);
a.click();
})
cloneNode(true)属性介绍: http://www.w3school.com.cn/jsref/met_node_clonenode.asp
④:其实mui官方也提供了相应的解决方法,官方链接 http://dev.dcloud.net.cn/mui/window/#openwindow,代码如下:
- //tap为mui封装的单击事件,解决移动端click事件点击延迟300毫秒的问题
- document.getElementById('info').addEventListener('tap', function() {
- //打开关于页面
- mui.openWindow({
- url: 'examples/info.html',
- id:'info'
- });
- });