How to use the laypage paging control by instance _ javascript skills

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.