Skip to content

Instantly share code, notes, and snippets.

@tejas-kr
Created April 21, 2018 06:05
Show Gist options
  • Save tejas-kr/3353984adf3eee1c9fc78e570f31530e to your computer and use it in GitHub Desktop.
Save tejas-kr/3353984adf3eee1c9fc78e570f31530e to your computer and use it in GitHub Desktop.
javascript animation to make a typing text effect and a floating text effect.
// keep the code neat...
(function() {
var i = 0;
var txt = 'Tejas Jaiswal'; /* The text */
var speed = 200; /* The speed/duration of the effect in milliseconds */
function typeWriter() {
// console.log('teff');
if (i < txt.length) {
document.getElementById("demo12").innerHTML += txt.charAt(i);
i++;
setTimeout(typeWriter, speed);
} else {
typeDescPoints();
}
}
// var j = 0;
var bio = [];
bio.push("A dedicated sofware developer.");
bio.push("Hand on experience with real-world live projects.");
bio.push("Know multiple languages like Javascript, PHP, Python, Java.");
bio.push("Experience with various frameworks of many programming languages.");
for(var j = 0; j < bio.length; j++){
$("#descop").append("<li style='display: none;' class='liss' id='deslist"+j+"'>"+ bio[j] +"</li>");
}
var k = 0;
lis = $(".liss").hide();
function typeDescPoints() {
lis.eq(k++).fadeIn(200, typeDescPoints);
}
// Calling the above funcitons
typeWriter();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment