homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

animation delay

Msg#: 4393570 posted 8:59 pm on Dec 2, 2011 (gmt 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(){


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved