html - How can I 'grow' text in only one direction if the text is centered? -
i'm trying create overlay says: 'waiting...', want ellipses animated. text go from:-
'waiting' -> 'waiting.' -> 'waiting..' -> 'waiting...' -> 'waiting' ->
however, when ellipses count changes it's pushing 'waiting' left since content centered in container.
html:
<div style='text-align: center'> <span>waiting</span> <span id='ellipses'></span> </div>
javascript:
var ellipses = 0; setinterval(function () { $('#ellipses').text('.'.repeat(ellipses)) ellipses = (ellipses + 1) % 4; }, 400)
any way handle ?, easy magic numbers or manual calculation of 'center'
+ fixed position, i'd have clean css solution if possible..
using pure css, try fiddle,
.ellipses1 { -webkit-animation: elipses 1.3s infinite; -webkit-animation-delay: 0.0s; } .ellipses2 { -webkit-animation: elipses 1.3s infinite; -webkit-animation-delay: 0.2s; } .ellipses3 { -webkit-animation: elipses 1.3s infinite; -webkit-animation-delay: 0.3s; } @-webkit-keyframes elipses { 0% { opacity: 0; } 50% { opacity: 0; } 100% { opacity: 1; } }
Comments
Post a Comment