材料刷新点击事件不起作用

时间:2016-09-08 05:28:18

标签: javascript refresh swipe

我使用这个插件material-refresh来刷新页面,但是当页面在顶部滚动时#TOP; TOP = 0"点击不会开火,当我向下滚动1px它正常工作这里图像更好地解决问题 enter image description here

这里是测试代码



  var opts_stream = {
        nav: '.page_header',
        scrollEl: '.page_content',
        onBegin: function() {
            console.log("start");
        },
        onEnd: function() {
            console.log("Done");
        }
    };
    mRefresh(opts_stream);

       .page_header {
            width: 100%;
            height: 100px;
            background-color: red;
            text-align: center;
        }

        .page_content {
            width: 100%;
            height: 1200px;
            background-color: rgb(190, 190, 190);
            text-align: center;
        }

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>sdasd</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  <link href="https://github.com/lightningtgc/material-refresh/blob/master/src/css/material-refresh.styl">
    <script src="https://raw.githubusercontent.com/lightningtgc/material-refresh/master/src/js/main.js"></script>
</head>

<body>
    <div class="page_header">
        Header
    </div>
    <div class="page_content">
        <button type="button" name="button" onclick="alert('test');">Test Button</button>
    </div>
</body>


</html>
&#13;
&#13;
&#13;

注意:您需要从Chrome控制台以移动心情运行浏览器才能运行此插件

1 个答案:

答案 0 :(得分:1)

在第304行的touchEnd函数中,在material-refresh.js中删除e.preventDefault();  :)