-------page Scroll to the bottom of the query data unlimited load no bottom display no more--------
Principle: 1, enter the URL into page 2, a page in the ajax--controller---query database---Controller to get the data HTML tag stitching Ajax back to HTML
3, Ajax get splicing string added to the specified location display 4, JS get window size when scrolling to the bottom again AJAX---CONTROLLER---DATABASE---controller---HTML
5, Ajax get splicing string added to the specified location display if Ajax returns empty at the bottom div shows no more data
Here is Example 1:
<! DOCTYPE html>
<meta charset= "UTF-8"/>
<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, User-scalable=no "/>
<meta http-equiv= "x-ua-compatible" content= "Ie=edge" >
<title>{:c (' Web_site_title ')}</title>
<meta name= "keywords" content= ""/>
<meta name= "description" content= ""/>
<link rel= "stylesheet" type= "Text/css" href= "__css__/dcrh-mobile.css"/>
<link rel= "stylesheet" type= "Text/css" href= "__user__/weui.css"/>
<script type= "Text/javascript" src= "__static__/jquery.js" ></script>
<style>
Body{font-size:14px;font-family:helvetica;}
. border-top{border-top:1px solid #d9d9d9;}
. margin-top{margin-top:10px;}
. Huise{color: #888;}
/* Score Record */
. integral-div{padding:5px 15px;background-color: #fff;}
. Integral-text{color: #888; margin-left:20px;}
. left{float:left; width:50%;}
. right{float:right; width:50%;}
/* Second line */
. Two-div{background-color: #fff; margin-top:10px;font-size:12px;}
. two-1{padding:10px 0;margin:0 10px;font-size:14px;border-bottom:1px solid #eeeeee;}
. two-2{margin:0 10px;padding:5px 0;border-bottom:1px solid #eeeeee;}
. Two-right{float:right;}
. Two-right-num{position:relative;right:0;top:-16px;font-size:22px;color: #12c32f;}
. Lvse{color: #12c32f;}
/* No More * *
. nogengduo-js{padding:15px 15px; text-align:center;}
</style>
<body>
< top of!---
<div style= "height:40px;" ></div>
<div class= "Top" >
<a href= ' Javascript:history.go ( -1) ' class= ' Back ' style= '-webkit-tap-highlight-color:rgba (0, 0, 0, 0); " > back </a>
<span style= "Display:inline-block;" > Points Record </span>
</div>
<!--points Record-
<div class= "Data" ></div>
<!--no More--
<div class= "Integral-div nogengduo-js" style= "Display:none;" >
<span class= "Huise" > No More Records! </span>
</div>
<!--hidden Fields--
<input type= "hidden" value= "0" id= "Kaishi" >
<input type= "hidden" value= "id=" >
</body>
<script type= "Text/javascript" >
Gets the current position of the scroll bar
function Getscrolltop () {
var scrolltop = 0;
if (document.documentelement && document.documentElement.scrollTop) {
ScrollTop = Document.documentElement.scrollTop;
}
else if (document.body) {
ScrollTop = Document.body.scrollTop;
}
return scrolltop;
}
Gets the current height of the range
function Getclientheight () {
var clientheight = 0;
if (document.body.clientHeight && document.documentElement.clientHeight) {
ClientHeight = Math.min (Document.body.clientHeight, document.documentElement.clientHeight);
}
else {
ClientHeight = Math.max (Document.body.clientHeight, document.documentElement.clientHeight);
}
return clientheight;
}
Get the full height of the document
function Getscrollheight () {
Return Math.max (Document.body.scrollHeight, document.documentElement.scrollHeight);
}
</script>
<script>
$ (function () {
var start = number ($ ("#kaishi"). Val ());
var num = $ ("#xianshi"). Val ();
alert (start);
$.ajax ({
URL: "__module__/fans/jiazaijifen_jilu",
Type: "Post",
data:{"Start": Start, "num": num},
Async:true,
Success:function (res) {
if (res = = null) {
$ (". Nogengduo-js"). CSS ("Display", "block");
}
$ ("#kaishi"). Val (start);
$ ('. Data '). Append (res);
}
});
});
Window.onscroll = function () {
if (getscrolltop () + getclientheight () = = Getscrollheight ()) {
var start = number ($ ("#kaishi"). Val ()) +20;
var num = $ ("#xianshi"). Val ();
alert (start);
$.ajax ({
URL: "__module__/fans/jiazaijifen_jilu",
Type: "Post",
data:{"Start": Start, "num": num},
Async:true,
Success:function (res) {
if (res = = null) {
$ (". Nogengduo-js"). CSS ("Display", "block");
}
$ ("#kaishi"). Val (start);
$ ('. Data '). Append (res);
}
});
}
}
</script>
Mobile Unlimited Load Tutorial