Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var currentCol = $('.box:first');
- var text = currentCol.html();
- currentCol.html('');
- text = text.replace(/ (?![^<>]*>)/gi, '%^%');
- var wordArray = text.split('%^%');
- $.fn.hasOverflow = function() {
- var div = this[0];
- return div.scrollHeight>div.clientHeight;
- };
- for(var x=0; x<wordArray.length; x++){
- var word= wordArray[x];
- currentCol.append(word+' ');
- if (currentCol.hasOverflow()){
- currentCol = currentCol.next('.box');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement