div li的多行多列 无刷新分页示例代码

yipeiwu_com6年前PHP代码库
翻页文件一次加载了全部的内容,因而不是很适合大型的网站,而适用于数据比较少的情况。
本例未使用数据库。
 
PHP Code
复制代码 代码如下:

<div class="container">
<ul id="content">
<?php for ($i=1; $i<=53; $i++){?>
<li><span><?php echo $i?></span></li>
<?php }?>
</ul>
<div class="holder"></div>
</div>

JavaScript Code
<script type="text/javascript">
$(document).ready(function() {
$("div.holder").jPages({
containerID : "content",
perPage: 6
});
});
</script>
[/code]
CSS Code
复制代码 代码如下:

body {
text-align: left;
direction: ltr;
font-family:tahoma,verdana,arial,sans-serif;
font-size: 11px;
}
.container {
width: 370px;
height: 100%;
margin: 0 auto;
}
/*
@@ Demo
*/
ul {
margin: 0;
padding: 20px 0px;
}
ul li {
list-style-type: none;
display: inline-block;
line-height: 100px;
text-align: center;
font-weight: bold;
width: 100px;
height: 100px;
margin: 10px;
background: #ccc;
}
ul li span {
color: #fff;
padding: 3px;
}
/*
@@ Pagination
*/
.holder { margin: 5px 0; }
.holder a {
font-size: 12px;
cursor: pointer;
margin: 0 5px;
color: #333;
}
.holder a:hover {
background-color: #222;
color: #fff;
}
.holder a.jp-previous { margin-right: 15px; }
.holder a.jp-next { margin-left: 15px; }
.holder a.jp-current, a.jp-current:hover {
color: #ed4e2a;
font-weight: bold;
}
.holder a.jp-disabled, a.jp-disabled:hover { color: #bbb; }
.holder a.jp-current, a.jp-current:hover,
.holder a.jp-disabled, a.jp-disabled:hover {
cursor: default;
background: none;
}
.holder span { margin: 0 5px; }

本例还使用了一个js jquery.pages.js 请到演示页面查看源码

相关文章

php Redis函数用法实例总结【附php连接redis单例类】

本文实例总结了php Redis函数用法。分享给大家供大家参考,具体如下: 一直在拿PHP使用Redis,但是总感觉不牢靠,索性借这个时间空余一气呵成, 把PHP中所有操作到的Redis...

php实现将base64格式图片保存在指定目录的方法

本文实例讲述了php实现将base64格式图片保存在指定目录的方法。分享给大家供大家参考,具体如下: <?php header('Content-type:text/h...

php fsockopen中多线程问题的解决办法[翻译]

问题: 有没有办法在php中实现多线程呢? 假设你正在写一个基于多台服务器的php应用,理想的情况时同时向多台服务器发送请求,而不是一台接一台。 可以实现吗? 回答: 当有人想要实现并发...

php实现简易聊天室应用代码

php实现简易聊天室应用代码

核心逻辑 在定义应用程序的核心功能之前,先来看一看聊天应用程序的基本外观,如以下截图所示: 通过聊天窗口底部的输入框输入聊天文本。点击Send按钮,就开始执行函数set_chat_ms...

浅谈PHP封装CURL

浅谈PHP封装CURL

CURL是一个非常强大的开源库,支持很多协议,包括HTTP、FTP、TELNET等,我们使用它来发送HTTP请求。它给我 们带来的好处是可以通过灵活的选项设置不同的HTTP协议参数,并且...