Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3662046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:22:21+00:00 2026-05-19T01:22:21+00:00

I was asked if I could come up with a text effect in HTML

  • 0

I was asked if I could come up with a text effect in HTML using jQuery where I get a string and then the routine automatically detects the words and animates each word in, one at a time.

Like.

  1. sec into the animation shows: “Happy”

  2. sec into the animation shows:”Happy New”

  3. sec into the animation shows:”Happy New Year”

  4. sec into the animation shows:”Happy New Year 2011″

each word should “fade/animate” in slowly, I thought a simple sliding pane going right in pixels would be satisfying – but no. Word by word.

I could need some ideas on this one. I know some jQuery and a lot of Javascript, so I guess I need a bit of help with the jQuery part.

For the list of words, I would just split on ” ” (whitespace) and accept that “,.!” etc are part of a word.

But how do I animate this “dynamic array” in jQuery – is there a plugin somewhere or am I the first?

I was thinking that perhaps a bulleted list could be the trick too, then make it float horizontally like a menu and then add the word as a new bullet, once per second. But I am excited to see what the experts in here come up with for solution. :O)

EDIT
From the marked answer, I’ve this:

    var str = $('div#greeting h1').html(); // grab text
    $('div#welcome h1').html(""); // clear text

    var spans = '<span>' + str.split(" ").join(' </span><span>') + '</span>';
    $(spans).hide().appendTo('div#greeting h1').each(function(i)
    {
        $(this).delay(500 * i).fadeIn();
    });

The STRONG tag works, but somehow parts of the text fades in a group.

Try this:
“here is a test text. [strong]We believe this is better[/strong] than ever.” and see the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:22:22+00:00Added an answer on May 19, 2026 at 1:22 am

    Working example: http://jsfiddle.net/TcdQb/

    var str = $('span.ticker').text();
    
    var spans = '<span>' + str.split(/\s+/).join(' </span><span>') + '</span>';
    
    $(spans).hide().appendTo('body').each(function(i) {
        $(this).delay(1000 * i).fadeIn();
    });
    
    • This places the words in span tags: "<span>Happy </span><span>New </span><span>Year </span><span>2011</span>"

    • Creates DOM elements: $(spans)

    • Hides them: .hide()

    • Appends them: .appendTo('body')

    • Finally, iterates over them using .each(), and .delay() the .fadeIn() of each one by 1000ms multiplied by the current index of the iteration.


    EDIT: Here’s an update to the example that uses a shorter delay, and a longer animation, so the animations overlap a little.

    http://jsfiddle.net/TcdQb/1/

        $(this).delay(400 * i).fadeIn(1000);
    

    EDIT: To deal with nested tags (one level deep only) you could do this:

    http://jsfiddle.net/WgMrz/

    var h1 = $('div#greeting h1');
    
    h1.hide().contents().each(function() {
        var words;
        if (this.nodeType === 3) {
            words = '<span> ' + this.data.split(/\s+/).join(' </span><span> ') + ' </span>';
            $(this).replaceWith(words);
        } else if (this.nodeType === 1) {
            this.innerHTML = '<span> ' + this.innerHTML.split(/\s+/).join(' </span><span> ') + ' </span>';
        }
    });
    
       // Remove any empty spans that were added
    h1.find('span').hide().each(function() {
        if( !$.trim(this.innerHTML) ) {
            $(this).remove();
        }
    });
    
    h1.show().find('span').each(function(i) {
        $(this).delay(400 * i).fadeIn(600);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a little off the ballpark, but a friend asked me about
This is probably a kinda commonly asked question but I could do with help
I asked before about pixel-pushing, and have now managed to get far enough to
Has anyone come up with a good way of performing full text searches (
I've got a standard UITableViewCell where I'm using the text and image properties to
In a previous question I asked how I could display two different layouts for
As is asked in here . I could run vi or mate within emacs.
My friend (who knows nothing about programming what-so-ever) asked me if I could develop
could someone summarize in a few succinct words how the boost shared_from_this<>() smart pointer
When asked to create system XYZ and you ask to do it in Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.