亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

急急忙忙寫了個JS分頁。先存著了,有時候再改

發布時間:2020-06-28 13:12:30 來源:網絡 閱讀:454 作者:s363905520 欄目:編程語言
function Page(index, size, count) {
                var len = 10,
                        show = len - 3;


                var prev = $("<li />").addClass("prev").html('<a href="#">上一頁</a>');
                var next = $("<li />").addClass("next").html('<a href="#">下一頁</a>');
                var li;
                if (index <= 0) prev.addClass("disabled");
                if (index >= count / size || index + 1 >= count / size) next.addClass("disabled");
                var _p = $(".dataTables_paginate > ul");


                _p.html("");

                //上一頁
                prev.click(function () {
                        if (index > 0) load(index);
                });
                _p.append(prev);
                if (index * size >= count) {
                        li = $("<li />").html('<a href="#">1</a>').addClass("active");
                        _p.append(li);
                }
                var _page = (count % size) == 0 ? count / size : parseInt(count / size) + 1;
                if (index * size < count) {

                        if (_page <= len) {
                                for (var i = 1; i < _page + 1; i++) {
                                        li = $("<li />").html('<a href="#">' + i + '</a>');
                                        if (i === index + 1) li.addClass("active");
                                        _p.append(li);
                                }
                        }

                        if (_page > len) {

                                if (index < show) {
                                        for (var i = 1; i < 9; i++) {
                                                li = $("<li />").html('<a href="#">' + i + '</a>');
                                                if (i === index + 1) li.addClass("active");

                                                _p.append(li);
                                        }
                                        _p.append(li);
                                        $("<li />").html('<a href="#">...</a>').appendTo(_p);

                                        li = $("<li />").html('<a href="#">' + _page + '</a>');

                                        _p.append(li);

                                }
                                if (index >= show && index <= _page - show) {

                                        /* 第一頁*/
                                        li = $("<li />").html('<a href="#">1</a>');

                                        _p.append(li);

                                        $("<li />").html('<a href="#">...</a>').appendTo(_p);


                                        /*中間頁*/

                                        for (var i = index - 2; i < index + 6; i++) {
                                                li = $("<li />").html('<a href="#">' + i + '</a>');
                                                if (i === index + 1) li.addClass("active");
                                                _p.append(li);
                                        }


                                        /* 最后頁*/
                                        $("<li />").html('<a href="#">...</a>').appendTo(_p);

                                        li = $("<li />").html('<a href="#">' + _page + '</a>');

                                        _p.append(li);

                                }

                                if (index > _page - show) {
                                        /* 第一頁 */
                                        li = $("<li />").html('<a href="#">1</a>');

                                        _p.append(li);

                                        $("<li />").html('<a href="#">...</a>').appendTo(_p);


                                        /* 中間頁 */

                                        for (var i = _page - 8; i < _page + 1; i++) {
                                                li = $("<li />").html('<a href="#">' + i + '</a>');
                                                if (i === index + 1) li.addClass("active");

                                                _p.append(li);
                                        }

                                }

                        }
                        next.click(function () {
                                if (index < _page - 1) load(index + 2);
                        });
                        _p.append(next);

                        $("li:not(:first):not(:last) a").click(function () {
                                var _pa = $(this).text();
                                if (_pa != "...") {

                                        load(_pa);
                                }

                        });
                }
        }
CSS:
 

.pagination
{
        height
: 36px;
        margin
: 18px 0;
}

        .pagination ul
{
                display
: inline-block;
                *display
: inline;
                *zoom
: 1;
                margin-left
: 0;
                margin-bottom
: 0;
                -webkit-border-radius
: 3px;
                -moz-border-radius
: 3px;
                border-radius
: 3px;
                -webkit-box-shadow
: 0 1px 2px rgba(0, 0, 0, 0.05);
                -moz-box-shadow
: 0 1px 2px rgba(0, 0, 0, 0.05);
                box-shadow
: 0 1px 2px rgba(0, 0, 0, 0.05);
        }

                .pagination ul > li
{
                        display
: inline;
                }

                        .pagination ul > li > a, .pagination ul > li > span
{
                                float
: left;
                                padding
: 0 14px;
                                line-height
: 34px;
                                text-decoration
: none;
                                background-color
: #ffffff;
                                border
: 1px solid #dddddd;
                                border-left-width
: 0;
                        }

                                .pagination ul > li > a:hover, .pagination ul > .active > a, .pagination ul > .active > span
{
                                        background-color
: #f5f5f5;
                                }

                .pagination ul > .active > a, .pagination ul > .active > span
{
                        color
: #999999;
                        cursor
: default;
                }

                .pagination ul > .disabled > span, .pagination ul > .disabled > a, .pagination ul > .disabled > a:hover
{
                        color
: #999999;
                        background-color
: transparent;
                        cursor
: default;
                }

                .pagination ul > li:first-child > a, .pagination ul > li:first-child > span
{
                        border-left-width
: 1px;
                        -webkit-border-radius
: 3px 0 0 3px;
                        -moz-border-radius
: 3px 0 0 3px;
                        border-radius
: 3px 0 0 3px;
                }

                .pagination ul > li:last-child > a, .pagination ul > li:last-child > span
{
                        -webkit-border-radius
: 0 3px 3px 0;
                        -moz-border-radius
: 0 3px 3px 0;
                        border-radius
: 0 3px 3px 0;
                }

.pagination-centered
{
        text-align
: center;
}

.pagination-right
{
        text-align
: right;
}
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

新化县| 南召县| 伊宁县| 澄迈县| 吉木乃县| 平乡县| 遵义县| 年辖:市辖区| 凌云县| 遂平县| 景宁| 靖安县| 黑山县| 久治县| 嘉善县| 鹤庆县| 鞍山市| 会泽县| 行唐县| 宜城市| 凭祥市| 华池县| 遵化市| 读书| 康保县| 枣强县| 滦平县| 常山县| 登封市| 合山市| 孙吴县| 化德县| 景谷| 蕉岭县| 长丰县| 兴海县| 康定县| 浦东新区| 航空| 阳信县| 乌苏市|