This article mainly shares with you the use of the laypage paging control instance, which has some reference value. interested friends can refer to the paging problems frequently encountered during development, especially for a back-end program ape, but this problem cannot be solved, so I found a paging control for use and recorded it for later use.
The following is a simple example on the official website:
// The following uses jquery. ajax is used as an example to demonstrate an asynchronous paging $. getJSON ('test/demo1.json ', {curr: 6}, function (res) {// The request starts from page 6th. The returned json format can be any laypage ({cont: 'page1 ', // container. The id, native dom object, and jquery object are supported. [If This container is ]:Pages: res. pages, // The total number of pages obtained through the background curr: 6, // initialize the current page jump: function (e) {// call back after triggering pagination $. getJSON ('test/demo1.json ', {curr: e. curr}, function (res) {e. pages = e. last = res. pages; // obtain the total number of pages again. you do not need to write // render var view = document. getElementById ('view1'); // You can also directly use jquery var demoContent = (new Date (). getTime ()/Math. random ()/1000) | 0; // here only to demonstrate the view. innerHTML = res. content + demoContent ;});}});});
A basic paging effect is displayed.
If you need other more elegant effects, please modify the source code.
First, if a page is displayed.
First, reference the control laypage. js.