我有一个静态div,我想使用PHP或JS为此创建一个分页。我们说我有25个div,我只希望每页显示5个div。怎么做?
这里是html div的格式
<div class="newsbox">
<img src="#" class="news-img"/>
<div class="newsmargin">
<br />
<h3 class="news-h3">Title</h3>
<span style="color: gray; font-size: 14px;">28.9.2015</span>
<p class="newslineheight">Content</p>
<a class="buttonv1" href="#" target="_blank" style="padding: 10px 15px 10px 15px; line-height: 60px;">Read more</a></div>
</div>
<br />
<div class="newsbox">
<img src="#" class="news-img"/>
<div class="newsmargin">
<br />
<h3 class="news-h3">Title</h3>
<span style="color: gray; font-size: 14px;">28.9.2015</span>
<p class="newslineheight">Content</p>
<a class="buttonv1" href="#" target="_blank" style="padding: 10px 15px 10px 15px; line-height: 60px;">Read more</a></div>
</div>
答案 0 :(得分:1)
尝试使用java脚本:
演示:http://jsfiddle.net/fSmEL/167/
<div class="pagnation">
<div class="newsbox">div1</div>
<div class="newsbox">div2</div>
<div class="newsbox">div3</div>
<div class="newsbox">div4</div>
<div class="newsbox">div5</div>
<div class="newsbox">div6</div>
<div class="newsbox">div7</div>
<div class="newsbox">div8</div>
<div class="newsbox">div9</div>
<div class="newsbox">div10</div>
<div class="newsbox">div11</div>
<div class="newsbox">div12</div>
<div class="newsbox">div13</div>
<div class="newsbox">div15</div>
<div class="newsbox">div15</div>
</div>