Skip to content

Instantly share code, notes, and snippets.

@joseadrian
Last active December 29, 2015 15:59
Show Gist options
  • Save joseadrian/7694538 to your computer and use it in GitHub Desktop.
Save joseadrian/7694538 to your computer and use it in GitHub Desktop.
jQuery Lines examples
$('.first').lines({
replace: function(lines) {
var lastLine = lines[lines.length-1];
var center = $(this).width()/2 - lastLine.width/2;
lines[lines.length-1].text = '<span style="position:relative;margin-left:'+center+'px">'+lastLine.text+'</span>';
return lines;
}
});
$('.second').lines({
onLine: function(lineNumber, line){
if(Math.random() >= 0.5){
return '<span>'+line.text+'</span>';
}
}
});
$('.third').lines({
truncate: 5,
ellipsis: '...'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment