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 8133341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:34:30+00:00 2026-06-06T09:34:30+00:00

I have this following jquery text fly-in animation.Here is my code before I explain

  • 0

I have this following jquery text fly-in animation.Here is my code before I explain further:

<script type="text/javascript">

$(document).ready(function(){

    $('.flying1 .flying-text').css({opacity:0});
    $('.flying1 .active-text').animate({opacity:1, marginLeft: "0px"}, 1200); //animate first text
    var int = setInterval(changeText, 3500);    // call changeText function every 5 seconds

function changeText(){  
    var $activeText = $(".flying1 .active-text");     //get current text    
    var $nextText = $activeText.next();  //get next text

    if ($activeText.is('.end')) {
        $activeText.stop().delay(5000);
        $('.flying1').html('<div class="flying-text active-text">Text4<div>
                                <div class="flying-text">Text5</div>
                                <div class="flying-text end2">Text6</div>');
        $('.flying1 .flying-text').css({opacity:0});
        $('.flying1 .active-text').animate({opacity:1, marginLeft: "0px"}, 1200); //animate first text
    };

    if ($activeText.is('.end2')) {
        $activeText.stop().delay(5000);
        $('.flying1').html('<div class="flying-text active-text">Text1<div>
                                <div class="flying-text">Text2</div>
                                <div class="flying-text end">Text3</div>');
        $('.flying1 .flying-text').css({opacity:0});
        $('.flying1 .active-text').animate({opacity:1, marginLeft: "0px"}, 1200); //animate first text
    };

    $nextText.css({opacity: 0}).addClass('active-text').animate({opacity:1, marginLeft: "0px"}, 1200, function(){

        $activeText.removeClass('active-text');                                           
    });
}
});
</script>

HTML

<div class="flying-text active-text">Text1<div>
<div class="flying-text">Text2</div>
<div class="flying-text end">Text3</div>

Now as you can see, Text1-3 animates/flies in first, then when Text3 is reached, they are replaced by Text4-6 in the animation, when Text6 is reached again, it loops back to Text1-3 again…Now basically what I want to do is pause/delay the animation for longer when it reaches the end of the Text, that is at Text3(class=”flying-text end”) and Text6(class=”flying-text end2″. So I want Text3 and Text6 to animate longer than all the others. how do I do that? The code I used :

$activeText.stop().delay(5000);

does not work…

Thank You

  • 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-06-06T09:34:32+00:00Added an answer on June 6, 2026 at 9:34 am

    I think you’ve made things over-complicated for yourself.

    You just need to use normal setTimeout to trigger the next animation, but do that within the animation “complete” function to ensure that you’re not mixing animation timers with normal timers.

    You should also avoid setInterval for the same reason – it’ll fall out of sync with any animation timers, particularly when the jQuery authors revert back to using requestAnimationFrame.

    Here’s my solution:

    var text = [
        ['Text1', 'Text2', 'Text3'],
        ['Text4', 'Text5', 'Text6']
        ];
    
    var n = 0,
        page = 0;
    var $f = $('.flying-text');
    
    function changeText() {
        $f.eq(n).text(text[page][n]).css({
            opacity: 0,
            marginLeft: '-50px'
        }).animate({
            opacity: 1,
            marginLeft: "0px"
        }, 1200, function() {
            if (++n === 3) {
                page = 1 - page;
                n = 0;
                setTimeout(function() {
                    $f.empty();
                    changeText();
                }, 6000);
            } else {
                setTimeout(changeText, 2000);
            }
        });
    };
    
    changeText();​
    

    working demo at http://jsfiddle.net/alnitak/GE2gN/

    Note that this completely separates the text content from the animation logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery code in my view <script type=text/javascript> $(document).ready(function () {
i have the following Jquery function inside my view:- <script type=text/javascript> $(document).ready(function () {
I have the following jQuery function embedded in an MVC Razor page: <script type=text/javascript>
i have the following jquery: <script type=text/javascript src=./js/jquery-1.7.2.min.js></script> <script type=text/javascript> $(document).ready(function() { $(.indexSlideMenu1_Folder div).click(function()
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
I have the following JQuery code: $(this).text('Options &#x25B4;'); However, the ascii code isn't showing
I have used the script at: http://www.javascript-coder.com/ i use the following jquery code in
So I have this JQuery template that calls a function: <script id=Fred type=text/x-jQuery-tmpl> <td>${functionX()}${Field2}</td>
I have the following jQuery-tmpl template: <script id=month-template type=text/x-jquery-tmpl> <div style=width:${width};> <div>Hello</div> </div> </script>
I have the following jquery script: $(function(){ $('#top-menu').on('click', 'a.change-menu', function(e){ e.preventDefault() $(#menu-change-div).load($(this).attr(href)); }); });

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.