components_pagination.js 5.34 KB
Newer Older
Luis Gangas committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
/* ------------------------------------------------------------------------------
*
*  # Pagination component
*
*  Specific JS code additions for components_pagination.html page
*
*  Version: 1.0
*  Latest update: Aug 1, 2015
*
* ---------------------------------------------------------------------------- */

$(function() {


    // Bootpag dynamic pagination
    // ------------------------------

    // Basic
    $('.bootpag-default').bootpag({
        total: 20,
        maxVisible: 6,
        leaps: false
        }).on("page", function(event, num){
            $(".content-default").html("Page " + num); // or some ajax content loading...
    }).children('.pagination').addClass('pagination-sm');


    // Flat style
    $('.bootpag-flat').bootpag({
        total: 20,
        maxVisible: 6,
        leaps: false
        }).on("page", function(event, num){
            $(".content-flat").html("Page " + num); // or some ajax content loading...
    }).children('.pagination').addClass('pagination-flat pagination-sm');


    // Separated style
    $('.bootpag-separated').bootpag({
        total: 20,
        maxVisible: 6,
        leaps: false
        }).on("page", function(event, num){
            $(".content-separated").html("Page " + num); // or some ajax content loading...
    }).children('.pagination').addClass('pagination-separated pagination-sm');


    // Custom button text
    $('.bootpag-prev-next').bootpag({
        total: 10,
        maxVisible: 5,
        leaps: false,
        prev: 'prev',
        next: 'next'
        }).on("page", function(event, num){
            $(".content-prev-next").html("Page " + num); // or some ajax content loading...
    }).children('.pagination').addClass('pagination-flat pagination-sm');


    // Custom start page
    $('.bootpag-page-start').bootpag({
        total: 10,
        maxVisible: 6,
        page: 3,
        leaps: false
        }).on("page", function(event, num){
            $(".content-page-start").html("Page " + num); // or some ajax content loading...
    }).children('.pagination').addClass('pagination-flat pagination-sm');


    // Callback
    $('.bootpag-callback').bootpag({
        total: 10,
        maxVisible: 6,
        leaps: false
        }).on("page", function(event, num){
            $(".content-callback").html("Page " + num); // or some ajax content loading...
            alert('You have clicked page #' + num);
    }).children('.pagination').addClass('pagination-flat pagination-sm');



    // TWBS dynamic pagination
    // ------------------------------

    // Basic
    $('.twbs-default').twbsPagination({
        totalPages: 35,
        visiblePages: 4,
        prev: 'Prev',
        first: null,
        last: null,
        onPageClick: function (event, page) {
            $('.twbs-content-default').text('Page ' + page);
        }
    });


    // Flat style
    $('.twbs-flat').twbsPagination({
        totalPages: 35,
        visiblePages: 4,
        prev: 'Prev',
        first: null,
        last: null,
        onPageClick: function (event, page) {
            $('.twbs-content-flat').text('Page ' + page);
        }
    });


    // Separated style
    $('.twbs-separated').twbsPagination({
        totalPages: 35,
        visiblePages: 4,
        prev: 'Prev',
        first: null,
        last: null,
        onPageClick: function (event, page) {
            $('.twbs-content-separated').text('Page ' + page);
        }
    });


    // Custom button text
    $('.twbs-prev-next').twbsPagination({
        totalPages: 35,
        visiblePages: 4,
        prev: '⇠',
        next: '⇢',
        first: '⇤',
        last: '⇥',
        onPageClick: function (event, page) {
            $('.twbs-content-prev-next').text('Page ' + page);
        }
    });


    // Custom start page
    $('.twbs-page-start').twbsPagination({
        totalPages: 35,
        visiblePages: 4,
        startPage: 3,
        prev: 'Prev',
        first: null,
        last: null,
        onPageClick: function (event, page) {
            $('.twbs-content-page-start').text('Page ' + page);
        }
    });


    // Set number of visible pages
    $('.twbs-visible-pages').twbsPagination({
        totalPages: 35,
        visiblePages: 4,
        prev: '←',
        next: '→',
        first: null,
        last: null,
        onPageClick: function (event, page) {
            $('.twbs-content-visible-pages').text('Page ' + page);
        }
    });



    // Date paginator
    // ------------------------------

    // Basic
    $('.datepaginator-default').datepaginator({
        itemWidth: 70,
        navItemWidth: 28
    });


    // Days format
    $('.datepaginator-days-format').datepaginator({
        itemWidth: 70,
        navItemWidth: 28,
        text: 'dddd<br/>Do'
    });


    // Hide calendar
    $('.datepaginator-calendar').datepaginator({
        itemWidth: 70,
        navItemWidth: 28,
        showCalendar: false
    });


    // Highlight selected date
    $('.datepaginator-highlight-selected').datepaginator({
        itemWidth: 70,
        navItemWidth: 28,
        highlightSelectedDate: false
    });


    // Highlight today's date
    $('.datepaginator-highlight-today').datepaginator({
        itemWidth: 70,
        navItemWidth: 28,
        highlightToday: false
    });


    // Custom item width
    $('.datepaginator-item-width').datepaginator({
        itemWidth: 50,
        navItemWidth: 28
    });

});