Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Word by word fade in animation javascript/jquery

I'm looking for a way to show this animation BUT with different duration between each word and breaking the line(You can see it in YouTube video)

https://youtu.be/KwELYWNpMyE

I've also took some further steps but no success.

https://jsfiddle.net/5zo9sh8b/19/
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Implement the text to time function, as you wish. It is a simple code, but you can improve it.

var $el = $(".example:first"), text = $.trim($el.text()),
    words = text.split(" "), html = "";

for (var i = 0; i < words.length; i++) {
    html += "<span style=\"display:none\">" + words[i] + ((i+1) === words.length ? "" : " ") + "</span>";
}
elements = $el.html(html).children();

function text_to_time(text){
    // implement your function
    times = [100, 100, 100, 100, 100, 1000, 1500, 1500, 2000, 2000];
  return times[text.length];
}

function next_word(i, _elements){
    element = _elements[i];
  element = $(element);
  
  element.fadeIn(500, function() {
      i = i + 1;
    if (_elements.length > i){
        time = text_to_time($(_elements[i]).text());
        setTimeout(function() {
            next_word(i, _elements);
      }, time);
    }
  });
}

setTimeout(function() {
  next_word(0, elements);
}, 1000);
.example{
  font-size:5vw;
  font-weight:700;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<div class="example">
    Ohne uns wäre es einfach
</div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda