Last active
June 27, 2019 19:19
-
-
Save kenold/7b1883cfd97cba93d997bbc2aa3a8ab4 to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Text Anim</title> | |
<style type="text/css"> | |
#word { | |
background: yellow; | |
width: 200px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="word">Alpha</div> | |
<!-- import JQuery --> | |
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> | |
<script type="text/javascript"> | |
$(function () { | |
count = 0; | |
// add text list in quotes | |
wordsArray = ["Beta <br /> Yo", "Gamma", "Delta", "Alpha"]; | |
intervalId = setInterval(function () { | |
count++; | |
if (count === wordsArray.length) { | |
clearInterval(intervalId); | |
} | |
$("#word").fadeOut(400, function () { | |
$(this).html(wordsArray[count % wordsArray.length]).fadeIn(400); | |
}); | |
}, 2000); //text duration | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment