https://github.com/litten/pagectrl
PageCtrl help to handle your paging problems.分页组件,用于处理页面分页问题。
https://github.com/litten/pagectrl
Last synced: 2 months ago
JSON representation
PageCtrl help to handle your paging problems.分页组件,用于处理页面分页问题。
- Host: GitHub
- URL: https://github.com/litten/pagectrl
- Owner: litten
- Created: 2014-07-30T12:24:52.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-07-31T07:23:48.000Z (about 12 years ago)
- Last Synced: 2025-03-02T02:16:07.743Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 145 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#PageCtrl
分页组件,用于前端页面处理分页问题。
1. 支持AMD
2. 支持[grunt-imweb-tpl-complie](https://www.npmjs.org/package/grunt-imweb-tpl-complie)模版组件
3. 兼容所有浏览器
4. 基于Jquery
### 使用 Usage:
**1、实例化**
```js
/* @info new PageCtrl(ctn, fn)
* @param ctn {Dom} 目标节点
* @param fn {Function} 点击页码回调函数 cur-当前点击页码;pre-点击之前页面
*/
var pc = new PageCtrl($('.sort-page'), function pageActionFn(cur, pre) {
console.log('当前点击:'+cur + ', pre:'+pre);
});
```
**2、初始化**
```js
/* @param total {Number} 总页码数;
* @param idx {Number} 当前页码,默认从1开始;
* @param max {Number} 最多显示数,可为空默认为5;限制页码区域,超出部分用…代替
*/
pageCtrl.init({
'total': 100,
'idx': 1
'max': 5
});
```
### 展示 Show:
根据设定的`total, idx, max`3个值进行计算,将分页模块智能展示为几种不同样式。
具体请查看[demo](http://littendomo.sinaapp.com/pagectrl/example.html)。
