x***@vip.qq.com
x***@vip.qq.com
  • 发布:2016-04-12 18:00
  • 更新:2016-04-18 11:11
  • 阅读:1292

为什么事件无法触发???

分类:MUI

<!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();
mui(".mui-table-view").on('tap','.mui-table-view-cell',function(){
alert("tap event trigger");
});
</script>
</head>
<<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">我的标题</h1>
</header>
<div class="mui-content">
<ul class="mui-table-view" id="my_task_list">
<li class="mui-table-view-cell">
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
待办事项1
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
待办事项2
</div>
</li>
</ul>
</div>
</body>
</html>

2016-04-12 18:00 负责人:无 分享
已邀请:
Android_XR

Android_XR

测试是有用的,请参考mui demo写法。

x***@vip.qq.com

x***@vip.qq.com (作者)

我测试了N编 我上面的代码 确实无法触发 你确定和我的代码一摸一样吗

  • Android_XR

    你的js脚本写的位置有问题,你把脚本写到dom加载完后面再测试就有用了。

    2016-04-18 11:13

Android_XR

Android_XR

<!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" />  
</head>  
<<body>  

    <header class="mui-bar mui-bar-nav">  

        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>  

        <h1 class="mui-title">我的标题</h1>  

    </header>  

    <div class="mui-content">  

        <ul class="mui-table-view" id="my_task_list">  

            <li class="mui-table-view-cell">  

                <div class="mui-slider-right mui-disabled">  

                    <a class="mui-btn mui-btn-red">删除</a>  

                </div>  

                <div class="mui-slider-handle">  

                    待办事项1  

                </div>  

            </li>  

            <li class="mui-table-view-cell">  

                <div class="mui-slider-right mui-disabled">  

                    <a class="mui-btn mui-btn-red">删除</a>  

                </div>  

                <div class="mui-slider-handle">  

                    待办事项2  

                </div>  

            </li>  

        </ul>  

    </div>  
    <script type="text/javascript" charset="UTF-8">  
        mui.init();  
        mui(".mui-table-view").on('tap', '.mui-table-view-cell', function() {  
            alert("tap event trigger");  
        });  
    </script>  

    </body>  

</html>

该问题目前已经被锁定, 无法添加新回复