Home  >  Article  >  php教程  >  php/mysql/jquery实现各系统流行的瀑布流显示方式,实现很简单的

php/mysql/jquery实现各系统流行的瀑布流显示方式,实现很简单的

WBOY
WBOYOriginal
2016-06-06 20:13:471157browse

大家在用这个东西的时候一定要计得有这么几个文件,一个是jquery.js 还有就是你自己数据库的密码。和相对应的图片才可以正常看到效果。下面就是这里所有的代码!!!HTML文件:waterfall.html !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN

大家在用这个东西的时候一定要计得有这么几个文件,一个是jquery.js 还有就是你自己数据库的密码。和相对应的图片才可以正常看到效果。下面就是这里所有的代码!!! HTML文件:waterfall.html

<pre lang="php">

 
 
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <title>瀑布流-Derek</title>
 <script type="text/javascript" language="javascript" src="http://shaozhuqing.com/jquery.js"></script>
 <link type="text/css" rel="stylesheet" href="http://shaozhuqing.com/waterfall.css">
 <script type="text/javascript" language="javascript" src="http://shaozhuqing.com/waterfall.js"></script>
 
 
  
     
  /* * Javascript文件:waterfall.js */ $(function(){ jsonajax(); });   //这里就要进行计算滚动条当前所在的位置了。如果滚动条离最底部还有100px的时候就要进行调用ajax加载数据 $(window).scroll(function(){ //此方法是在滚动条滚动时发生的函数 // 当滚动到最底部以上100像素时,加载新内容 var $doc_height,$s_top,$now_height; $doc_height = $(document).height(); //这里是document的整个高度 $s_top = $(this).scrollTop(); //当前滚动条离最顶上多少高度 $now_height = $(this).height(); //这里的this 也是就是window对象 if(($doc_height - $s_top - $now_height) temp_h){ iheight = temp_h; $row = $(this); //此时$row是li对象了 } }); $item = $('
php/mysql/jquery实现各系统流行的瀑布流显示方式,实现很简单的
'+neirou.title+'
').hide(); $row.append($item); $item.fadeIn(); } } } }); }   /* * CSS文件:waterfall.css */   body{text-align:center;} /*Download by http://www.codefans.net*/ #stage{ margin:0 auto; padding:0; width:880px; } #stage li{ margin:0; padding:0; list-style:none;float:left; width:220px;} #stage li div{ font-size:12px; padding:10px; color:#999999; text-align:left; }     /* * php文件:data.php */ $v){ $json_arr[] = (object)$v; } //print_r($json_arr); echo json_encode( $json_arr );
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn