精灵采集器
首页
产品功能
购买价格
建站教程
当前位置 :
可视化教程
>
正文
H5设计精灵的分页样式

分页样式虽然很短,但是复用率非常高,H5设计精灵的分页样式整理,以后用起来也方便点。

<div class="pagination-wrapper">  <div class="pagination"><br>    <li><a>首页</a></li><br>    <li><a>上一页</a></li><br>    <li><a>1</a></li><br>    <li><a>下一页</a></li><br>    <li><a>末页</a></li> <br>  </div><br></div>

样式一



/*pages*/ .pagination-wrapper { clear:both; padding:1em 0 2em 0; text-align:center; } <br>.pagination { display: inline-block; *display: inline; *zoom: 1; font-size:12px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); } <br>.pagination li{ list-style: none; display: inline; float: left; line-height: 1em; text-decoration: none; border: 1px solid #ddd; border-left-width: 0; } <br>.pagination li a { display: inline-block; padding: .5em .8em; background-color: #f9f9f9; color: #999; } <br>.pagination li a:link{ background:#fff; color: #4C78A5; } .pagination li a:hover{ text-decoration:none; } <br>.pagination li a:link:hover { color: #000; } .pagination li.thisclass { background-color: #f9f9f9; color:#999; } .pagination li:first-child { border-left-width: 1px; border-radius: 3px 0 0 3px; } <br>.pagination li:last-child{ border-radius: 0 3px 3px 0; } .pagination .pageinfo{ color: #444; }

样式二


/*pages*/ .pagination-wrapper{ margin: 20px 0; } .pagination{ height: 34px; text-align: center; } <br>.pagination li { display: inline-block; height: 34px; margin-right: 5px; }<br> .pagination li a{ float: left; display: block; height: 32px; line-height: 32px; padding: 0 12px; font-size: 16px; border: 1px solid #dddddd; color: #555555; text-decoration: none; } <br>.pagination li a:hover{ background:#f5f5f5; color:#0099ff; }<br>.pagination li.thisclass { background: #09f; color: #fff; } .pagination li.thisclass a,.pagination li.thisclass a:hover{ background: transparent; border-color: #09f; color: #fff; cursor: default; }

生成脚本的函数

<br>function h5InitTemplate(pageidx){ <br>    var recordnum=128;<br>    var rowsperpage=8;<br>    h5Paginate({<br>        containter:'.pagination'<br>        ,prev:':nth-child(2)'<br>        ,next:':nth-child(4)' <br>        ,first:':nth-child(1)' <br>        ,last:':nth-child(5)' <br>        ,pagenumber:':nth-child(3)'<br>        ,selectedClass:'thisclass'<br>        ,pageid:pageidx<br>        ,totalrows:recordnum<br>        ,pagerows:rowsperpage<br>        ,maxpage:8<br>        ,pagehref:function(idx){<br>            return 'news'+(idx==0?'':idx)+'.html';<br>        }<br>    })<br>    <br>    return 'news'+(pageidx==0?'':pageidx)+'.html';<br>}

姓名:
评论

vvv

2020-12-05 11:12:36

dd

©2018-2020 h5spirit.cn  | 京ICP备19057243号-1 | QQ群:694364182