91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

急急忙忙寫了個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

环江| 岳西县| 永胜县| 长顺县| 吉安市| 汶川县| 阳城县| 永吉县| 灌云县| 太原市| 油尖旺区| 忻州市| 稻城县| 胶州市| 陇西县| 濮阳市| 阿瓦提县| 新余市| 边坝县| 密山市| 东山县| 清丰县| 宁乡县| 封开县| 林周县| 米易县| 德昌县| 吴忠市| 鄂温| 琼结县| 扶风县| 安顺市| 鄂州市| 牟定县| 清丰县| 青阳县| 方城县| 桃源县| 米泉市| 宜良县| 平山县|