Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

animation delay

8:59 pm on Dec 2, 2011 (gmt 0)

New User

5+ Year Member

joined:Sept 30, 2010
posts: 34
votes: 0

I have this animation working but it takes at least 15s for the first animation to start...

The page is completely loaded and nothing happens during that time and it's only happening the very first sequence.

Here's my code:
<script type="text/javascript">
$('.container .flying-text').css({opacity:0}); //set all text opacity to 0
$('.container .active-text').animate({opacity:.8, left: "250px"}, 8000); //animate first text

var int = setInterval(changeText, 9000); // call changeText function every 5 seconds

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

if($activeText.next().length == 0) $nextText = $('.container .flying-text:first'); //if it is last text, loop back to first text
$activeText.animate({opacity:0}, 1000); //set opacity 0 to animated text
$activeText.animate({left: "0"}); //set animated text position to default

//animate next text
$nextText.css({opacity: 0}).addClass('active-text').animate({opacity:.8, left: "200px"}, 8000, function(){