Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. var currentCol = $('.box:first');
  2. var text = currentCol.html();
  3. currentCol.html('');
  4. text = text.replace(/ (?![^<>]*>)/gi, '%^%');
  5. var wordArray = text.split('%^%');
  6.  
  7.  
  8.  
  9. $.fn.hasOverflow = function() {
  10. var div = this[0];
  11. return div.scrollHeight>div.clientHeight;
  12. };
  13.  
  14.  
  15. for(var x=0; x<wordArray.length; x++){
  16. var word= wordArray[x];
  17. currentCol.append(word+' ');
  18. if (currentCol.hasOverflow()){
  19. currentCol = currentCol.next('.box');
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement