{"id":19691301,"url":"https://github.com/wang2lang/pagination","last_synced_at":"2025-04-29T09:30:56.135Z","repository":{"id":57120930,"uuid":"83669814","full_name":"wang2lang/pagination","owner":"wang2lang","description":"Pagination implemented in pure JavaScript","archived":false,"fork":false,"pushed_at":"2017-03-03T04:32:20.000Z","size":10,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-22T23:49:43.202Z","etag":null,"topics":["javascript","pager","pagination"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wang2lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-02T11:21:14.000Z","updated_at":"2023-03-10T09:13:48.000Z","dependencies_parsed_at":"2022-08-24T04:40:35.869Z","dependency_job_id":null,"html_url":"https://github.com/wang2lang/pagination","commit_stats":null,"previous_names":["rainjay/pagination"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang2lang%2Fpagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang2lang%2Fpagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang2lang%2Fpagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang2lang%2Fpagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wang2lang","download_url":"https://codeload.github.com/wang2lang/pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251473175,"owners_count":21595016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","pager","pagination"],"created_at":"2024-11-11T19:08:42.954Z","updated_at":"2025-04-29T09:30:55.838Z","avatar_url":"https://github.com/wang2lang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-pagination\npagination implemented in pure JavaScript\n\n## Install \u0026 run example\n```\n// install\nnpm i -S 'js-pagination'\n\n// run example\ngit clone https://github.com/rainjay/pagination.git\ncd pagination\nnpm install\nnpm run dev\n```\n\n## Example demo\n\u003ca href=\"https://jsfiddle.net/rainjay/ktyptn74/\" target=\"_blank\"\u003eDEMO\u003c/a\u003e\n\n## Usage\n```\nrequire('js-pagination/dist/styles.css')\nvar Pagination = require('js-pagination')\n\n// config\nPagination.config({\n  ulClass: 'pagination',\n  activeClass: 'active',\n  ...\n})\n\n// use\nvar myPager = new Pagination(100, 15, function(page) {}, '.field')\n\nmyPager.getCurrentPage()\nmyPager.goToPage(num)\n\n// html\n\u003cdiv class=\"field\"\u003e\u003c/div\u003e\n```\n\n## API\n\n###  config attributes (optional)\n| key | Type | Details                                                    |\n| :----- | :----: | :-------:                                             |\n| ulClass | String | class name for page lists, default 'pagination'      |\n| activeClass | String | class name for active page item, default 'active'|\n| disableClass | String | disable class name for disabled item, default 'disabled'|\n| dots | String | default '...'                                           |\n| hideIfEmpty | Boolean | whether to hide paging if only have one page, default true|\n|showPreNext| Bollean|whether show pre and next button, default true      |\n| scrollTop   | Bollean | whether scroll to top after you select one page, default false            |\n| scrollContainer| String | which container to scroll                     |\n| adjacent | Number|the page amount before and after the current page, default 2|\n| lang | 'cn' or 'en' | default 'cn'                                      |\n\n\n### var pager = new Pagination(total, size, callback, fieldSelector)\n| key | Type | Details                                                    |\n| :----- | :----: | :-------:                                             |\n| total | Number | the total size of what you are displaying              |\n| size | Number | size of each page, default 1                            |\n| size | Number | size of each page, default 1                            |\n|callback| Function | call back for page select operation                 |\n|fieldSelector| String | the field u want to mount, exp: '.field'         |\n\n### pager.goToPage(num)\n| key | Type | Details                                                    |\n| :----- | :----: | :-------:                                             |\n| num | Number |  the page num will go to                                 |\n\n### pager.getCurrentPage()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang2lang%2Fpagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwang2lang%2Fpagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang2lang%2Fpagination/lists"}