function Createli () {var oli=document.createelement (' Li '); Oli.style.height=parseint (50+math.random () *400) + ' px '; o li.style.background= ' RGB (' +rnd (0,255) + ', ' +rnd (0,255) + ', ' +rnd (0,255) + ') '; return oLi;}; function rnd (n,m) { return parseint (Math.random () * (m-n+1) +n);}; Window.onload=function () {Odiv=document.getelementbyid (' div1 '); var aul=odiv.children;function create () {for (Var i=0 ; i<20; i++) {var oli=createli (), Var arr=[];for (var j=0; j<aul.length; J + +) {arr[j]=aul[j];}; Arr.sort (function (OUL1,OUL2) {return oul1.offsetheight-oul2.offsetheight;}); Arr[0].appendchild (OLi);}}; Create (); Window.onscroll=function () {var winh=document.documentelement.clientheight;var scrolltop= document.documentelement.scrolltop| | Document.body.scrolltop;var scrollheight=document.body.scrollheight;if (scrolltop>=scrollheight-winh-200) { Create ();}}}
The above code is a simple waterfall flow of the package code, here is the time to scroll randomly out of different colors,
The effect is this, you can try
Simple Waterfall Flow Package