Earlier I have gotten good help here with some issues regarding overflowing text, and how to get this into new divs. Ref: Issues with text formatting after jQuery
Now I'm seeing differences in how the text is displayed through different browsers, i.e. IE11 and Chrome. I know this is normal, but I wonder what I can change in my code to get them to display similar. You can see the fiddle for how it looks in IE11: http://jsfiddle.net/hm2yfw61/9/ Here the text flows 3-4 lines over the area I want the text to be shown.
For a live test you can view my test page here: http://tangeland.net/brev/test.php - displays strange in IE11. In Chrome it looks better, but there I would say it maybe cuts to much of the text before it starts with a new div.
Here is the jquery I've used:
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');
}
}
Thanks!