2012-03-29 63 views
0

我使用一个contentSwitcher开发一个登陆页面,一切正常,但我; M想知道如何制作动画的内容一个接一个,只是添加一些花哨的风格。 Test Landing Page开关内容,动画内容

您可能会看到下面有标题,副标题,段落和图片,我如何将fadeIn添加到每个这些元素中间隔几秒钟?

感谢您的帮助!

回答

0

您可以使用时将触发回调函数当动画完成

到这里看看:

http://api.jquery.com/fadeIn/

例子:

$('#element1').fadeIn('slow', function() { 
     // this will be called then the first animation is complete 

     $('#element2').fadeIn('slow', function() { 
     // this will be called then the second animation is complete 

      $('#element3').fadeIn('slow', function() { 
      // this will be called then the third animation is complete 


      }); 


     }); 

}); 

要推迟动画几秒钟,使用.delay()

http://api.jquery.com/delay/

+0

谢谢sotn0r,我决定添加你的建议,更新:[link](http://jsfiddle.net/n29YG/11/) – MrD 2012-03-29 19:59:26

+0

我被卡住了,我有2个容器(id),每个容器都有自己的菜单。我希望在这些容器之间切换,因为每个容器代表不同的语言内容。我分配了切换呼叫,但切换后,第一个脚本停止工作。得到这个的最好方法是什么?我做错了什么?请帮忙! [链接](http://jsfiddle.net/n29YG/12/) – MrD 2012-04-17 07:05:32