Home  >  Article  >  Web Front-end  >  Layui paging effect realizes code sharing

Layui paging effect realizes code sharing

小云云
小云云Original
2018-01-11 17:01:223660browse

This article mainly introduces the implementation code of layui front-end frame paging effect in detail. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.


<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>分页</title>
  <link rel="stylesheet" href="layui/css/layui.css" >
 </head>
 <body>
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
   <legend>开门见山 : 默认分页</legend>
  </fieldset>
  <p id="demo1"></p>
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
   <legend>开启 URL hash</legend>
  </fieldset>
  <p id="demo5"></p>

  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
   <legend>是时候看一下完整功能了!</legend>
  </fieldset>
  <p id="demo7"></p>

  <script src="layui/layui.js"></script>
  <script>
   layui.use([&#39;laypage&#39;, &#39;layer&#39;], function(){
    var laypage = layui.laypage
    ,layer = layui.layer;

    laypage({
     cont: &#39;demo1&#39;
     ,pages: 100 //总页数
     ,groups: 5 //连续显示分页数
    });

    laypage({
     cont: &#39;demo5&#39;
     ,pages: 100
     ,curr: location.hash.replace(&#39;#!fenye=&#39;, &#39;&#39;) //获取hash值为fenye的当前页
     ,hash: &#39;fenye&#39; //自定义hash值
    });
    laypage({
     cont: &#39;demo7&#39;
     ,pages: 100
     ,skip: true
    });
   });
  </script>
 </body>
</html>

Rendering:

Related recommendations:

Simple implementation of Ajax without Refresh the paging effect

PHP function example that imitates Google’s paging effect

php example of implementing the paging effect

The above is the detailed content of Layui paging effect realizes code sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn