Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                 <div class="custom-pagination container" data-count="5">
                <div class="listing-outer">
                    <div class="item-listing ">
                        <div class="item-single">
                            <h4>Page 1</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 1</h4>
                            <b>Is the bus suitable for children?</b>
                            <p>Yes, it is suitable for children and appropriate sized lifejackets are available on request. Children must be under adult supervision at all times.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 1</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 1</h4>
                            <b>Is the bus suitable for children?</b>
                            <p>Yes, it is suitable for children and appropriate sized lifejackets are available on request. Children must be under adult supervision at all times.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 1</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div> 


                        <div class="item-single">
                            <h4>Page 2</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 2</h4>
                            <b>Is the bus suitable for children?</b>
                            <p>Yes, it is suitable for children and appropriate sized lifejackets are available on request. Children must be under adult supervision at all times.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 2</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 2</h4>
                            <b>Is the bus suitable for children?</b>
                            <p>Yes, it is suitable for children and appropriate sized lifejackets are available on request. Children must be under adult supervision at all times.</p>
                        </div><div class="item-single">
                            <h4>Page 2</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div> 


                        <div class="item-single">
                            <h4>Page 3</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 3</h4>
                            <b>Is the bus suitable for children?</b>
                            <p>Yes, it is suitable for children and appropriate sized lifejackets are available on request. Children must be under adult supervision at all times.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 3</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 3</h4>
                            <b>Is the bus suitable for children?</b>
                            <p>Yes, it is suitable for children and appropriate sized lifejackets are available on request. Children must be under adult supervision at all times.</p>
                        </div>
                        <div class="item-single">
                            <h4>Page 3</h4>
                            <b>What is the maximum capacity if the bus?</b>
                            <p>Bus is surveyed to hold a maximum of 50 passengers. Please note, an infant, regardless of age is considered a passenger.</p>
                        </div> 
                    </div>
                </div>
                <div class="item-pagination">
                    <div class="clearfix text-right"> 
                        <span class="page-count"></span>
                        <ul class="pl-0 nav-arrows clearfix float-right">
                            <li class="prev"><a href="javaScript:void(0)" id="prevDealSlide"><i class="fas fa-chevron-left"></i></a></li>
                            <li class="next"><a href="javaScript:void(0)" id="nextDealSlide"><i class="fas fa-chevron-right"></i></a></li>
                        </ul>
                    </div>
                </div>
            </div> 
              
            
!

CSS

              
                .item-listing .item-single {
    padding: 35px 0;
    border-top: 1px solid #707070;
} 

.nav-arrows {
    li {
        float: left;
        width: 76px;
        height: 55px;
        border: 1px solid #000;
        text-align: center; 
        list-style: none;
        &.fs-pagi-disabled {
            pointer-events: none;
            background: #dadada;
            opacity: 0.3;
        } 
        &:hover {
            background-color: #000;

            a {
                color: #fff;
            }
        }

        &:first-child {
            border-radius: 30px 0 0 30px; 
        }

        &:last-child {
            border-left: none;
            border-radius: 0 30px 30px 0;
        }

        a {
            display: block;
            color: #000;
            line-height: 55px;
            font-size: 26px; 
        } 
    }
}

.page-count, .total-page-count {
    position: relative;
    top: 15px;
    right: 35px;
    color: #a0a0a0;
}

.pagi-disabled {
    pointer-events: none;
    background: #dadada;
    opacity: 0.3;
}
              
            
!

JS

              
                $(".custom-pagination").each(function () {
                var this_val = $(this);
                if ($('.custom-pagination').length > 0) {
                    var totalRows = this_val.find('.item-listing .item-single').length;
                    var pageSize = this_val.attr("data-count");
                    var noOfPage = totalRows / pageSize;
                    noOfPage = Math.ceil(noOfPage);
                    var noOfPageCount = noOfPage;

                    this_val.find('.total-page-count').remove();
                    this_val.find('.item-pagination .page-count').after('<span class="total-page-count"> / ' + noOfPageCount + '</span>');

                    for (var i = 1; i <= noOfPage; i++) {
                        if (i == 1) {
                            var classs = 'selected';
                        } else {
                            var classs = '';
                        }
                        this_val.find(".item-pagination .page-count").append('<b class=' + classs + '>' + i + '</b>');
                    }

                    var totalPagenum = this_val.find(".item-pagination .page-count b").length;
                    if (totalPagenum > 1) {
                        this_val.find(".item-pagination .page-count b").hide();
                        this_val.find('.prev').addClass('pagi-disabled');
                        for (var n = 1; n <= 1; n++) {
                            this_val.find(".item-pagination .page-count b:nth-child(" + n + ")").show();
                        }
                    }
                    else {
                        this_val.find(".prev").hide();
                        this_val.find(".next").hide();
                    }
                    this_val.find('.item-listing .item-single').hide();
                    for (var j = 1; j <= pageSize; j++) {
                        this_val.find(".item-listing .item-single:nth-child(" + j + ")").show();
                    }
                    displayevent($(this));
                }

                $(this).find('.next').on('click', function (ev) {
                    ev.preventDefault();
                    if ($(this_val).find("b.selected:last").nextAll('b').length > 1) {
                        $(this_val).find("b.selected").last().nextAll(':lt(1)').show();
                        $(this_val).find("b.selected").hide();
                        displayevent($(this_val));
                        $(this_val).find(".prev").removeClass('pagi-disabled');
                        $(this_val).find(".next").removeClass('pagi-disabled');
                    }
                    else {
                        $(this_val).find("b.selected").last().nextAll().show();
                        $(this_val).find("b.selected").hide();
                        displayevent($(this_val));
                        $(this_val).find(".prev").removeClass('pagi-disabled');
                        $(this_val).find(".next").addClass('pagi-disabled');
                    }
                    displayRows($(this_val));
                });

                $(this).find('.prev').on('click', function (ev) {
                    ev.preventDefault();
                    if ($(this_val).find("b.selected:first").prevAll('b').length > 1) {
                        $(this_val).find("b.selected").first().prevAll(':lt(1)').show();
                        $(this_val).find("b.selected").hide();
                        $(this_val).find(".prev").removeClass('pagi-disabled');
                        $(this_val).find(".next").removeClass('pagi-disabled');
                        displayevent($(this_val));
                    }
                    else {
                        $(this_val).find("b.selected").first().prevAll().show();
                        $(this_val).find("b.selected").hide();
                        $(this_val).find(".prev").addClass('pagi-disabled');
                        $(this_val).find(".next").removeClass('pagi-disabled');
                        displayevent($(this_val));
                    }
                    displayRows($(this_val));
                });

            })


/* PAGINATION FUNCTIONS */

function displayRows(this_current) {
    var currentPage = $(this_current).find('b.selected').text();
    $(this_current).find(".item-listing .item-single").hide();
    var pageSize = $(this_current).attr("data-count");
    for (var k = (currentPage * pageSize) - (pageSize - 1) ; k <= (currentPage * pageSize) ; k++) {
        $(this_current).find(".item-listing .item-single:nth-child(" + k + ")").show();
    }

    var customPaggiOffset = $(this_current).offset().top;
    $('html, body').animate({ scrollTop: '' + (customPaggiOffset - 200) + 'px' }, 800);
}

function displayevent(this_current) {
    $(this_current).find(".item-pagination .page-count b").each(function () {
        if ($(this).css('display') === 'inline') {
            $(this).addClass('selected');
        }
        else {
            $(this).removeClass('selected');
        }
    });
}

/* PAGINATION FUNCTIONS END */
              
            
!
999px

Console