javascript - Question on Browser Independant Multi-Column Text Paragraph Flower. (Works in IE8 IE9) -


some time ago, there question css3 multi-columns not being supported in ie9, or other ie matter. produced following quick simple , functional answer. want brush on , improve has flaw bottom line not justified. can see whats missing making bottom text line justified too? actually, coolest thing woulld make sense when there less half sentence on given line, followed dot, not justify line. sothat next paragraph more nicely visible. think of that? or perhaps have better ideas improve browser-independant multi-column script?

live test result url

var text=document.getelementbyid('text').innerhtml; var words=text.split(" "); var wordc=words.length; var length=words.join("").length; var cols= new array("","",""); var colc= new array(0,0,0); var col=0;  for(var i=0; i<wordc; i++){     cols[col]+=words[i]+" ";     if( (colc[col]+=words[i].length)>length/3)col++; } document.getelementbyid('text').innerhtml="<p>"+cols[0]+"</p><p>"+cols[1]+"</p><p>"+cols[2]+"</p>"; 

most of implementation see using div + p, check treesaver.js:

http://treesaverjs.com/

and if check specification of css3 multiple column, know there more properties columned layout.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -