Included: PHP, pagination, jquery, div+css
Example Download: http://download.csdn.net/detail/roro5119/7373905
index.php
<?//Database configuration fileinclude("conn.php");//default Search$page=$_get["Page"]?$_get["Page"]: 1;$pagesize= 20;$pageval= ($page-1) *20;$sql= "Select ' Pic ' from ' mypic ' limit$pageval,$pagesize";$query=mysql_query($sql);? ><! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >Auto;} . Showbox img{padding:5px; background:#CCCCFF;}. add-more{width:1000px; background:yellow;height:100px; line-height:30px; text-align:center; margin:0 auto; display :none;}</style><body><divclass= "Showbox" ><? while($row=Mysql_fetch_array($query)){? >$row["pic"];? > "width=" "height=" "><";? }?></div><!--Data loading hints, default hidden--><divclass= "Add-more" > Data loading ...</div><!--js section--><script type= "Text/javascript" > $(function(){ vardownrange = 100;//bottom Boundary-reference loading cue layer/px varnum = <?=$page;? >;//Initial page Number varMaxnum = num+5;//Set load times var $main= $ (". Showbox");//Main body var $loaddiv= $ (". Add-more")//load Cue layer varTotalheight = 0; //to determine whether an asynchronous functionifload () {//distance from top of scroll bar varScrolltotop=parsefloat ($ (window).scrolltop ()); //Window Height varWinheight = parsefloat ($ (window).height ()); //Total Content Height varConheight = parsefloat ($ (document). Height ())-downrange; //Total HeightTotalheight = Scrolltotop +Winheight; //decide whether to load, when the operation height is larger than the content, and the space is ample if(Totalheight >= conheight && num!=maxnum) {ajaxload (num); Num++; } } //Ajax-fun functionajaxload (page) {$.Ajax ({URL: "Ajax.php",type: "Post",Data: {Page:page,maxnum:maxnum},Success:function(Result) {//Append Data $main.append (result); } }) } //hide display in load $loaddiv. Ajaxstart (function() {$ (this).Show (); }). Ajaxstop (function() {$ (this).Hide (); }) //Scroll-fun$ (window).Scroll (ifload); })</script></body>
Asynchronous files:
<?//Database configuration fileinclude("conn.php");//Display information per page$pagesize=20;//Maximum load times$maxnum=$_post["Maxnum"]-1;//from where to start$page=$_post["Page"];$nextpagestart=$page*$pagesize;$sql= "Select ' Pic ' from ' mypic ' limit$nextpagestart,$pagesize";$query=mysql_query($sql); while($row=Mysql_fetch_array($query)){ //content? >$row["pic"];? > "width=" "height=" "><";?}//page Outif($page==$maxnum){ include(' page.class.php '); $sqlsum= "Select ' id ' from ' mypic '"; $querysum=mysql_query($sqlsum); //Total Data $total=mysql_num_rows($querysum); //parameters corresponding to location: Total record, number of bars per page, current page, connected address $my _page=NewPageclass ($total,$pagesize,$page, '? Page={page} '); //Output page Number Echo $my _page-Myde_write (); Exit;}?>