I made a heading (the word Welcome), which opens after loading the page ( onload="").
Fiddle if the code below does not work.
function animate() {
document.getElementById("mainText").style.width = "100%";
}
#mainText {
margin: 0px;
display: inline-block;
font-size: 100px;
width: 0%;
transition: width 2s;
white-space: nowrap;
overflow: hidden;
text-overflow: clip;
}
<body onload="animate()">
<h1 id="mainText">Welcome</h1>
</body>
Run codeHide resultCSS and Plain JS work fine, but I want the word “Welcome” to be shown on the right side first, and then move forward, so from e to W, instead of finding it now, it opens from left to right.
I tried text align: right;, but that doesn’t change anything.
I prefer not to use jQuery if this is a JS solution.
An example of what should look halfway though the transition:

source
share