Giter Club home page Giter Club logo

jquery-bootstrap-pagination's Introduction

jQuery Bootstrap Pagination

A simple, full-featured, pagination system for jQuery that outputs Twitter Bootstrap marked up pagination links. Of course, there's no reason you need to use this with Bootstrap, the HTML output is very clean.

Installation

The library can be used in CoffeeScript, JavaScript, and Rails applications very easily.

Standalone

CoffeeScript

Use the src/jquery-bootstrap-pagination.coffee file.

JavaScript

Use the vendor/assets/javascripts/jquery-bootstrap-pagination.js file. This file is auto generated from the CoffeeScript file.

Rails 3.x

Add this line to your application's Gemfile:

gem 'jquery-bootstrap-pagination'

And then execute:

$ bundle

Add it to your application.js file:

//= require jquery-bootstrap-pagination

Usage

CoffeeScript

# Basic usage:
$("#my-pagination-section").pagination()

# With options:
$("#my-pagination-section").pagination
  total_pages: 10
  current_page: 2
  callback: (event, page) ->
    alert("Page #{page} was clicked!")

# Retrieve the underlying PaginationView:
$("#my-pagination-section").data("paginationView")

JavaScript:

// Basic usage:
$("#my-pagination-section").pagination();

// With options:
$("#my-pagination-section").pagination({
  total_pages: 10,
  current_page: 2,
  callback: function(event, page) {
    return alert("Page " + page + " was clicked!");
  }
});

// Retrieve the underlying PaginationView:
$("#my-pagination-section").data("paginationView");

Options and Defaults:

# what is the current page:
current_page: 1
# how many pages are there total:
total_pages: 1
# change text of the 'next' link,
# set to false for no next link:
next: ">"
# change text of the 'previous' link,
# set to false for no previous link:
prev: "<"
# change text of the 'first' link,
# set to false for no first link:
first: false
# change text of the 'last' link,
# set to false for no last link:
last: false
# how many links before truncation happens:
display_max: 8
# render nothing if there is only 1 page:
ignore_single_page: true
# disable turbolinks:
no_turbolink: false

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write/Run tests (bundle exec rake)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

Contributors

  • Mark Bates
  • Eric Wollesen
  • Clinton Blackburn

jquery-bootstrap-pagination's People

Contributors

ewollesen avatar markbates avatar tzs007 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.