Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!