Code Monkey home page Code Monkey logo

Comments (5)

mescroll avatar mescroll commented on May 19, 2024

列表内容少于1页,应该在mescroll.endSuccess( dataSize ); 传入dataSize,内部会自动判断已无下一页~

如果是列表内容没有暂满屏幕,还有下一页,需要自动加载下一页的话,可配置up:{ loadFull: {use : true} },自动加载满屏

多看看案例和文档哦

from mescroll.

allycs avatar allycs commented on May 19, 2024

小姐姐太给力,问题依旧

from mescroll.

allycs avatar allycs commented on May 19, 2024
 var size = 5;
            var mescroll = new MeScroll("mescroll", {
                down: {
                    auto: true,
                    isBoth: false,
                    callback: downCallback
                },
                up: {
                    auto: true,
                    isBoth: false,
                    loadFull: { use: true, delay: 500  },
                    htmlNodata:'<p class="upwarp-nodata">-- 已到底 --</p>',
                    callback: upCallback
                }
            });
            function downCallback() {
                $.ajax({
                    url: '@Url.Content("~/content-hub/news/")' + departmentId + '/' + menuId + '/0/' + firstId + '/' + size,
                    success: function (data) {
                        var result = '';
                        var arrLen = data.newsList.length;
                        alert(arrLen);
                        if (arrLen < 7)
                            mescroll.endSuccess(arrLen);
                        else
                            mescroll.endSuccess();
                        if (arrLen > 0) {
                            firstId = data.firstNewsId;
                            lastId = data.lastNewsId;//0:为刷新,若10:则仅更新firstId;
                            result = getHtml(data.newsList);
                            $('.article_list_' + menuId).html(result);
                            console.log();
                        }
                        //$("#mescroll").removeClass("mescroll-hardware");
                        //$(".article_list_" + menuId).show();
                    },
                    error: function (data) {
                        mescroll.endErr(); 
                    }
                });
            }

            function upCallback(page) {
                $.ajax({
                    url: '@Url.Content("~/content-hub/news/")' + departmentId + '/' + menuId + '/20/' + lastId + '/' + size,//20:标签后增加;10:标签前增加;0:刷新
                    success: function (data) {
                        var arrLen = data.newsList.length;
                        if (arrLen == 0)
                            mescroll.endSuccess(0);
                        else
                            if (arrLen < 5)
                                mescroll.endSuccess(5);
                            else
                                if (arrLen == 5)
                                    mescroll.endSuccess(100);
                        if (arrLen > 0) {
                            lastId = data.lastNewsId;
                            result = getHtml(data.newsList);
                            $('.article_list_' + menuId).append(result);
                        }
                    },
                    error: function (data) {
                        mescroll.endErr();
                    }
                });
            }

from mescroll.

mescroll avatar mescroll commented on May 19, 2024

亲 size不能这样修改的; 如果你要修改一页5条数据,必须在new Mescroll的时候配置
//创建MeScroll对象 var mescroll = new MeScroll("mescroll", { down: { page: {size: 5} //配置每页加载5条数据 }, up: { callback: upCallback } });

from mescroll.

mescroll avatar mescroll commented on May 19, 2024

http://www.mescroll.com/qa.html#q7

from mescroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.