JQuery weui implementation page loading more

First of all, I want to say that when I just used the JQuery weui framework to do more loading, I encountered a pit. At the same time, I also downloaded the style of the SUI Mobile framework to do the page. As a result, it doesn't work when I load more controls with JQuery weui.

The reason is that the infinite in JQuery weui and the style layout in JQuery weui are bound, so they cannot take effect.

Solution: remove the style usage in SUI Mobile

1, More demo pull-up loading in JQuery weui

<!DOCTYPE html>
<html>
  <head>
    <title>Rolling loading</title>
    <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

<link rel="stylesheet" href="../lib/weui.min.css">
<link rel="stylesheet" href="../comm/css/jquery-weui.css">
<link rel="stylesheet" href="css/demos.css">

  </head>

  <body ontouchstart>

    <h1 class="demos-title">Rolling loading</h1>
    <div id="list" class='demos-content-padded'>
      
      <p><Selection of world famous computer teaching materials·Artificial intelligence:A modern method(The Third Edition)>It is the most authoritative and classic artificial intelligence textbook, which has been used by more than 1200 universities in more than 100 countries around the world. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper introduces the theory and practice of artificial intelligence comprehensively and systematically, expounds the core content of the field of artificial intelligence, and introduces the main research directions in depth. The book is divided into seven partsⅠPart "artificial intelligence", paraⅡPart "problem solving", paraⅢPart "knowledge, reasoning and planning", paraⅣPart "uncertain knowledge and reasoning", paraⅤPart "learning", sectionⅥPart "communication, perception and action", paraⅦPart "conclusion". Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper not only introduces the basic concepts, ideas and algorithms of AI in detail, but also describes the most cutting-edge progress in various research directions, and collects and sorts out detailed historical documents and events. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>Suitable for researchers and students of different levels and fields, it is the first choice of teaching materials for undergraduates and postgraduates in Colleges and universities, and also an important reference book for researchers and engineers in related fields.</p>
      
      <p><Selection of world famous computer teaching materials·Artificial intelligence:A modern method(The Third Edition)>It is the most authoritative and classic artificial intelligence textbook, which has been used by more than 1200 universities in more than 100 countries around the world. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper introduces the theory and practice of artificial intelligence comprehensively and systematically, expounds the core content of the field of artificial intelligence, and introduces the main research directions in depth. The book is divided into seven partsⅠPart "artificial intelligence", paraⅡPart "problem solving", paraⅢPart "knowledge, reasoning and planning", paraⅣPart "uncertain knowledge and reasoning", paraⅤPart "learning", sectionⅥPart "communication, perception and action", paraⅦPart "conclusion". Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper not only introduces the basic concepts, ideas and algorithms of AI in detail, but also describes the most cutting-edge progress in various research directions, and collects and sorts out detailed historical documents and events. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>Suitable for researchers and students of different levels and fields, it is the first choice of teaching materials for undergraduates and postgraduates in Colleges and universities, and also an important reference book for researchers and engineers in related fields.</p>
      
      <p><Selection of world famous computer teaching materials·Artificial intelligence:A modern method(The Third Edition)>It is the most authoritative and classic artificial intelligence textbook, which has been used by more than 1200 universities in more than 100 countries around the world. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper introduces the theory and practice of artificial intelligence comprehensively and systematically, expounds the core content of the field of artificial intelligence, and introduces the main research directions in depth. The book is divided into seven partsⅠPart "artificial intelligence", paraⅡPart "problem solving", paraⅢPart "knowledge, reasoning and planning", paraⅣPart "uncertain knowledge and reasoning", paraⅤPart "learning", sectionⅥPart "communication, perception and action", paraⅦPart "conclusion". Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper not only introduces the basic concepts, ideas and algorithms of AI in detail, but also describes the most cutting-edge progress in various research directions, and collects and sorts out detailed historical documents and events. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>Suitable for researchers and students of different levels and fields, it is the first choice of teaching materials for undergraduates and postgraduates in Colleges and universities, and also an important reference book for researchers and engineers in related fields.</p>
      
      <p><Selection of world famous computer teaching materials·Artificial intelligence:A modern method(The Third Edition)>It is the most authoritative and classic artificial intelligence textbook, which has been used by more than 1200 universities in more than 100 countries around the world. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper introduces the theory and practice of artificial intelligence comprehensively and systematically, expounds the core content of the field of artificial intelligence, and introduces the main research directions in depth. The book is divided into seven partsⅠPart "artificial intelligence", paraⅡPart "problem solving", paraⅢPart "knowledge, reasoning and planning", paraⅣPart "uncertain knowledge and reasoning", paraⅤPart "learning", sectionⅥPart "communication, perception and action", paraⅦPart "conclusion". Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper not only introduces the basic concepts, ideas and algorithms of AI in detail, but also describes the most cutting-edge progress in various research directions, and collects and sorts out detailed historical documents and events. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>Suitable for researchers and students of different levels and fields, it is the first choice of teaching materials for undergraduates and postgraduates in Colleges and universities, and also an important reference book for researchers and engineers in related fields.</p>
      
      <p><Selection of world famous computer teaching materials·Artificial intelligence:A modern method(The Third Edition)>It is the most authoritative and classic artificial intelligence textbook, which has been used by more than 1200 universities in more than 100 countries around the world. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper introduces the theory and practice of artificial intelligence comprehensively and systematically, expounds the core content of the field of artificial intelligence, and introduces the main research directions in depth. The book is divided into seven partsⅠPart "artificial intelligence", paraⅡPart "problem solving", paraⅢPart "knowledge, reasoning and planning", paraⅣPart "uncertain knowledge and reasoning", paraⅤPart "learning", sectionⅥPart "communication, perception and action", paraⅦPart "conclusion". Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>This paper not only introduces the basic concepts, ideas and algorithms of AI in detail, but also describes the most cutting-edge progress in various research directions, and collects and sorts out detailed historical documents and events. Selected textbooks of world famous computer·Artificial intelligence:A modern method(The Third Edition)>Suitable for researchers and students of different levels and fields, it is the first choice of teaching materials for undergraduates and postgraduates in Colleges and universities, and also an important reference book for researchers and engineers in related fields.</p>
      
    </div>
    <div class="weui-loadmore">
      <i class="weui-loading"></i>
      <span class="weui-loadmore__tips">Loading</span>
    </div>
    <script src="../lib/jquery-2.1.4.js"></script>
<script src="../lib/fastclick.js"></script>
<script>
  $(function() {
    FastClick.attach(document.body);
  });
</script>
<script src="../js/jquery-weui.js"></script>

    <script>
      var loading = false;
      $(document.body).infinite().on("infinite", function() {
        if(loading) return;
        loading = true;
        setTimeout(function() {
          $("#List "). Append (" < p > selection of world famous computer teaching materials · artificial intelligence: a modern method (version 3) "has more than 1100 pages in English version. The teaching content is very rich. It not only covers the classic contents of artificial intelligence foundation, problem solving, knowledge reasoning and planning, but also includes the introduction of uncertain knowledge and reasoning, machine learning, communication perception and action and other specialized knowledge. At present, the "Introduction to artificial intelligence", a compulsory course for undergraduates, mainly introduces the classic contents, while the core course "principles of artificial intelligence", a compulsory course for postgraduates, mainly focuses on the specialized knowledge. In fact, "the world famous computer textbook selection · artificial intelligence: a modern method (the Third Edition)" is also suitable for the general public who want to improve the design level of their own computing system and apply computing technology. It also has a certain reference role for the competitors and coaches who participate in the information Olympic competition and ACM programming competition. </p> "";
          loading = false;
        }, 2000);
      });
    </script>
  </body>

</html>

2, Scroll to load plus version

Requirement: when entering the page, the specified number of data pieces will be displayed through the pageSize;

Pull up display to load more, and then display more data content;

"No more data prompt" will be given after loading.

Core code:

<div id="content-wrap" class="content">
... Details
</div>
<div class="weui-loadmore" id="loading" style="display: none">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">Loading</span>
</div>
 var page = 1;
    //Enter page loading, here are more ways to pull up and load
    load(page);
    var loading = false;
    $(document.body).infinite().on("infinite", function () {
        if (loading) return;
        loading = true;
        setTimeout(function () {
            page = page + 1;
            var moreData = load(page);
            if (moreData[1] != 0) {
                $("#loading").css("display", "block");
                $("#content-wrap").append(moreData[0]);
                loading = false;
            } else {
                loading = true;
                $("#loading>span").html("No more data!").css("color", "#BDBDBD");
                $("#loading>i").css("display", "none");
            }
        }, 1000);
    });

    });

    function load(page) {
        storeToken();
        var max = 6;
        var morePage;
        var dataLength;
        var data = {
            "page": {
                "pageNo": page,
                "pageSize": max
            }
        };

       //Here's how to load the data
        var postSuccess = function (data) {
            var template = document.getElementById('show-template').innerHTML;
            var compiled = Template7(template).compile();
            var compiledRendered = compiled(data);
            // Insert rendered template
            dataLength = data.list.length;
            if (page > 1) {
                morePage = compiledRendered;
            } else {
                document.getElementById('content-wrap').innerHTML = compiledRendered;
            }
        };
        dopost(data, loan_record_url, true, postSuccess);
        return [morePage, dataLength];
    }

java Communication Group: 681223095

Pay attention to the public number, push more learning content, and strive for daily updates.

Tags: JQuery Mobile IE Google

Posted on Mon, 06 Jan 2020 16:10:27 -0800 by tha_mink