Skip to content
Browse files

change name from waterflow to waterfall

  • Loading branch information...
1 parent d3e2695 commit c1129c3d3419705070b4243f5dae2be6f5b1a7ad @chembohuang committed Jul 7, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 Readme.md
  2. +1 −1 demo.html
  3. +1 −1 js/jquery.cb.waterfall.plugin.js
  4. +1 −1 js/jquery.cb.waterfall.plugin.min.js
View
2 Readme.md
@@ -8,7 +8,7 @@ A waterfall plugin based on jquery. Supports window-resize & ajax.
<script type="text/javascript" src="js/jquery.cb.waterfall.plugin.min.js"></script>
<script type="text/javascript">
$(function(){
- $("#photo_wall").waterflow({
+ $("#photo_wall").waterfall({
ajaxUrl :"ajaxData.txt", ////ajax url. e.g. /server/loadMorePics.php. return json data as {["src":"2.jpg","desc":"description","link":"#"],["src":"4.jpg","desc":"description","link":"#"]}
ajaxParams :{"count":20,"userId":30}, //ajax params. e.g. {"name":"chembo","loadPic":"10"}
ajaxCount :5, //the total times of the ajax will run when scroll hits the bottom. default to 4.
View
2 demo.html
@@ -93,7 +93,7 @@
<script type="text/javascript" src="js/jquery.cb.waterfall.plugin.min.js"></script>
<script type="text/javascript">
$(function(){
- $("#photo_wall").waterflow({
+ $("#photo_wall").waterfall({
ajaxUrl :"ajaxData.txt", ////ajax url. e.g. /server/loadMorePics.php. return json data as {["src":"2.jpg","desc":"description","link":"#"],["src":"4.jpg","desc":"description","link":"#"]}
ajaxParams :{"count":20,"userId":30}, //ajax params. e.g. {"name":"chembo","loadPic":"10"}
ajaxCount :5, //the total times of the ajax will run when scroll hits the bottom. default to 4.
View
2 js/jquery.cb.waterfall.plugin.js
@@ -17,7 +17,7 @@
*/
(function($,window){
$window = $(window);
- $.fn.waterflow = function(options){
+ $.fn.waterfall = function(options){
var $element = $(this);
var settings = {
block_width :230, //one block's width.
View
2 js/jquery.cb.waterfall.plugin.min.js
@@ -1,4 +1,4 @@
-(function(e,r){$window=e(r);e.fn.waterflow=function(i){function k(){e.extend(a,i||{});a.parent_width=f.width();a.column=Math.floor(a.parent_width/(a.block_width+2*a.margin));a.side_margin=(a.parent_width-a.column*(a.block_width+2*a.margin))/2;d=f.children("."+a.block_class);a.block_count=d.length;n={width:a.block_width,margin:a.margin,"padding-top":a.margin};e("."+a.block_class).css(n);l=0;o=[];h=[];p="<div class='ablock'><a target='_blank' href='{2}'><img class='pic' src='{0}' /><p>{1}</p></a></div>";
+(function(e,r){$window=e(r);e.fn.waterfall=function(i){function k(){e.extend(a,i||{});a.parent_width=f.width();a.column=Math.floor(a.parent_width/(a.block_width+2*a.margin));a.side_margin=(a.parent_width-a.column*(a.block_width+2*a.margin))/2;d=f.children("."+a.block_class);a.block_count=d.length;n={width:a.block_width,margin:a.margin,"padding-top":a.margin};e("."+a.block_class).css(n);l=0;o=[];h=[];p="<div class='ablock'><a target='_blank' href='{2}'><img class='pic' src='{0}' /><p>{1}</p></a></div>";
j=false}function q(){a.block_count=d.length;for(var b,c=l;c<a.block_count;c++)if(c<a.column){e(d[c]).css({top:a.margin+"px",left:(a.block_width+2*a.margin)*(c%a.column)+a.side_margin+"px"}).animate({opacity:"show"},a.animate_duration);h[c]=e(d[c]).height()+a.margin}else{b=h.min_index();e(d[c]).css({top:h[b]+4*a.margin+"px",left:(a.block_width+2*a.margin)*b+a.side_margin+"px"}).animate({opacity:"show"},a.animate_duration);h[b]+=e(d[c]).height()+4*a.margin}l=c;f.height(h[h.max_index()])}function s(){j=
true;e("#loading").show();e.ajax({url:a.ajaxUrl,type:"post",data:a.ajaxParams,dataType:"json",success:function(b){e("#loading").hide();e.each(b,function(c){t(b[c].src,function(){f.append(p.template(b[c].src,b[c].desc,b[c].link));d.push(f.children(":last").css(n))})});q();j=false;a.ajaxCount--}})}var f=e(this),a={block_width:230,margin:3,block_class:"ablock",ajaxUrl:"",ajaxParams:{},ajaxCount:4,animate_duration:1E3},o,h,d,p,n,l,j;String.prototype.template=function(){var b=arguments;return this.replace(/\{(\d+)\}/g,
function(c,m){return b[m]})};Array.prototype.max_index=function(){for(var b=this[0],c=this.length,m=0,g=1;g<c;g++)if(this[g]>b){b=this[g];m=g}return m};Array.prototype.min_index=function(){for(var b=this[0],c=this.length,m=0,g=1;g<c;g++)if(this[g]<b){b=this[g];m=g}return m};r.onresize=function(){k();q()};r.onscroll=function(){if(Math.abs(document.body.clientHeight-document.documentElement.clientHeight)<=(document.documentElement.scrollTop||document.body.scrollTop))if(!j&&a.ajaxUrl!="")if(a.ajaxCount>

0 comments on commit c1129c3

Please sign in to comment.
Something went wrong with that request. Please try again.