LayUI paging component to achieve paging, mobile page number jump page flicker, seek optimization method.

Mobile page, the paging component of LayUI is used to achieve paging, and the function has been realized. Now the mobile page flashes fiercely when it jumps, so ask for advice on the solution.

clipboard.png

related codes

the html code is as follows:

                <div class="series_products">
                    <ul id="products_list"></ul>
                    <div id="demo3" class="layPage"></div>
                </div>

js code is as follows:
`/ / Local test data

var data = [{
                href: "javascript:;",
                src: "images/img7.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img8.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img9.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img10.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img11.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img12.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img12.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img11.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img10.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img9.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img8.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img7.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img12.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img11.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img10.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img9.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img8.jpg",
                name: ""
            },
            {
                href: "javascript:;",
                src: "images/img7.jpg",
                name: ""
            },
           
        ];
        layui.use(["laypage", "layer"], function () {
            var laypage = layui.laypage,
                layer = layui.layer;
            //
            laypage.render({
                elem: "demo3",
                count: data.length,
                limit: 6,
                groups: 4,
                theme: "-sharpff8874",
                first: "",
                last: "",
                layout: ["prev", "page", "next"],
                prev: "<em><</em>",
                next: "<em>></em>",
                jump: function (obj) {
                    //
                    document.getElementById("products_list").innerHTML = function () {
                        var arr = [],
                            // --.concat()
                            thisData = data.concat().splice(obj.curr * obj.limit -
                                obj.limit, obj.limit);
                        //thisData 
                        layui.each(thisData, function (index, item) {
                            arr.push("<li><a class="aLink"  href="" +
                                item.href +
                                ""/>" +
                                "<div class="products_pic"><img src="" +
                                item.src +
                                ""/></div>" +
                                "<p class="products_name">" +
                                item.name +
                                "

" + "</a></li>"); }); return arr.join(""); }(); } }); });

`

Dec.28,2021

it's rude to replace directly, both;

  1. Animation transition
  2. load the next page ahead of time
The problem of

has been solved. The reason for flashing so much is that the data rendering area does not have a given height. When rewriting the content, it flashes badly because the height increases from 0, which causes the following content to fall. After giving a fixed height to the render area, the flicker bug is roughly resolved.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e38b0c-444d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e38b0c-444d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?