jquery implementation HTML page div False paging has the principle of code _jquery

Source: Internet
Author: User

div fake pagination principle: The total height of the div (1000px) displayed height (100px) After the fill is 10 pages. When the second page is viewed, the div height displayed is between 100-200 and so on.

See the page in the pages actually move the div scroll bar.

<div id= "Applications" > Display data collection </div>
<style> 
#applications 
{/ 
* width:500px; adjust the width/height:1592px of the display area/ 
* Adjust the high/font-size of the display area 
: 14px; 
margin-top:23px; 
line-height:20px; 
Overflow-pageindex:hidden; 
Overflow-y: Hidden; 
Word-break:break-all; 
} 
</style>

<script language= "JavaScript" > 
var obj = document.getElementById ("Applications");//Get content layer 
var pages = document.getElementById ("pages"); Gets the page 
-Flip Layer window.onload = function ()//override form Loaded event 
{ 
var allpages = Math.ceil (parseint (obj.scrollheight)/ parseint (obj.offsetheight)); Get number of pages 
//pages.innerhtml = "<b> Total" + allpages-1+ "page </b>"; Number of output pages for 
(var i = 1; I <= allpages i++) { 
if (i = = 1) { 
pages.innerhtml = "<a href=\" Javascript:sh Owpage (' + i + '); \ "> Home </a>"; 
} 
else{pages.innerhtml + + " 
<a href=\" javascript:showpage (' + i + "); \" > "+ i +" </a> "; 
} 
The loop outputs the first few pages 
} 
} 
function ShowPage (pageINdex) { 
obj.scrolltop = (pageINdex-1) * parseint ( Obj.offsetheight); According to the height, output the specified page 
} 
</script>

Dynamic Data paging, the last page is not enough page number, you need to fill the specific height, or pagination will be the previous pages of the data repeatedly displayed on the last page.

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.