Last active
December 29, 2015 15:59
-
-
Save joseadrian/7694538 to your computer and use it in GitHub Desktop.
jQuery Lines examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.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; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.second').lines({ | |
onLine: function(lineNumber, line){ | |
if(Math.random() >= 0.5){ | |
return '<span>'+line.text+'</span>'; | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.third').lines({ | |
truncate: 5, | |
ellipsis: '...' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment