Code Monkey home page Code Monkey logo

me-pagination's Introduction

Me-Pagination

Javascript分页

通过Javascript进行分页

使用如下

<body>
	<div class="pagination" id="page"></div>
	<script src="pagination.js"></script>	// src 
	<script src="http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> // jquery
</body>
<script>
pagination({
	selector: '#page', // 选取的DOM
	totalPage: 10, // 总页数(可以从后台返回的记录总条数作为参数)
	currentPage: 1, // 当前页	默认第一页
	prev: '上一页', // 上一页 不传则默认为 <
	next: '下一页', // 下一页 不传则默认为 >
	first: true, // 是否显示首页
	last: true, // 是否显示尾页
	showTotalPage: true, // 是否显示总页数
	jumpBtn: true, // 需要跳转的输入框
	pageOneLoad: true, // 首页加载与否
	count: 2// 当前页前后显示的数量 比如当前页为3 那么前后显示两个即1 2  4 5
},function(pageVal){
	// 当前页
	console.log('page当前页',pageVal)
	$.ajax({  // 可以配合ajax 
	  	url: "baseUrl/page",
		type: 'POST',
		data:{
			page: pageVal	// 接收到返回的 当前页(第几页) 放入data中进行ajax请求
		},
		dataType: 'json',
		success: function (data) {
			console.log(data)
			// 指定页的数据处理...
		}
	})  
})
</script>

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.