码迷,mamicode.com
首页 > 其他好文 > 详细

layer分页问题

时间:2016-08-22 23:13:29      阅读:1671      评论:0      收藏:0      [点我收藏+]

标签:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="try13.aspx.cs" Inherits="Web.try13" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="myjs/pages/laypage.js"></script>
<script>
//测试数据
$(function () {
var data = [
‘北京‘,
‘上海‘,
‘广州‘,
‘深圳‘,
‘杭州‘,
‘长沙‘,
‘合肥‘,
‘宁夏‘,
‘成都‘,
‘西安‘,
‘南昌‘,
‘上饶‘,
‘沈阳‘,
‘济南‘,
‘厦门‘,
‘福州‘,
‘九江‘,
‘宜春‘,
‘赣州‘,
‘宁波‘,
‘绍兴‘,
‘无锡‘,
‘苏州‘,
‘徐州‘,
‘东莞‘,
‘佛山‘,
‘中山‘,
‘成都‘,
‘武汉‘,
‘青岛‘,
‘天津‘,
‘重庆‘,
‘南京‘,
‘九江‘,
‘香港‘,
‘澳门‘,
‘台北‘
];

var nums = 10; //每页出现的数量
var pages = Math.ceil(data.length / nums); //得到总页数

var thisDate = function (curr) {
//此处只是演示,实际场景通常是返回已经当前页已经分组好的数据
var str = ‘‘, last = curr * nums - 1;
last = last >= data.length ? (data.length - 1) : last;
for (var i = (curr * nums - nums) ; i <= last; i++) {
str += ‘<li>‘ + data[i] + ‘</li>‘;
}
return str;
};

//调用分页
laypage({
cont: ‘biuuu_city‘,
pages: pages,
groups: 3,
skin: ‘#c00‘,
skip: true,
jump: function (obj) {
document.getElementById(‘biuuu_city_list‘).innerHTML = thisDate(obj.curr);

//jump: function(obj, first){
//得到了当前页,用于向服务端请求对应数据 // var curr = obj.curr;

}
})
});
</script>
</head>
<body>
<ul id="biuuu_city_list"></ul>

<div id="biuuu_city"></div>
</body>
</html>

layer分页问题

标签:

原文地址:http://www.cnblogs.com/sdya/p/5797444.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!