varcolumns=3;varrows=3;var$rootElement=$("#example4");varcount=$rootElement.find("ul li").length;varround_split=Math.round(count/columns);varoffset=0;if(count<(columns*rows)){$rootElement.find(".vsToggleElement").hide();}if(count-(round_split*columns)==1){offset=1}varcol2_start=(round_split+1)+offsetvarcol3_start=((round_split*2)+1)+(offset*2)varlinks="ul li:nth-child(-n+"+rows+")";if(columns==2||columns==3){links+=", ul li:nth-child(+n"+col2_start+"):nth-child(-n+"+(col2_start+(rows-1))+")";}if(columns==3){links+=", ul li:nth-child(+n"+col3_start+"):nth-child(-n+"+(col3_start+(rows-1))+")";}$rootElement.find("ul li").not(links).addClass("vsHide");