Jump to content

FadeIn and fadeOut sequence using jquery and animate.css


sugafree

Recommended Posts

I want to create a main header where texts will bounce in, in 0.5s intervals and then at the same time it will all fade out, 1s interval again then new text will bounce in same intervals again and fade out. When it finished I want it to start from the beginning. I use animate.css, twitter-bootstrap and jquery. I have tried a few different ways, but so far I couldnt even get it to fade out after a short delay or if it fades out, it wont bounce in.

 

http://erotikus-munka.co.uk/test/index2.html

$( document ).ready(function() {  $( '.main2' ).addClass( 'bt_visible animated fadeInDownBig'),  $('.main2').addClass(3000, 'animated fadeOutDownBig')});$( document ).ready(function() {  $( '.main2' ).addClass( 'bt_visible animated fadeInDownBig');  $( ".main2" ).toggle( "puff" ).delay(3000);});$( document ).ready(function() {  $( '.main2' ).addClass( 'bt_visible animated fadeInDownBig');  $( ".main2" ).removeClass( 'bt_visible animated fadeInDownBig').delay(3000);  $( '.main2' ).addClass( 'bt_visible animated fadeOutDownBig').delay(3000);}); 
Link to comment
Share on other sites

Why do you have 3 sections for the document ready event? All of that code is going to run at the same time, why is it in 3 sections?What are you trying to do with this line:$('.main2').addClass(3000, 'animated fadeOutDownBig')According to the documentation I see, addClass takes a single parameter, either a string or a function. You're trying to pass 2 parameters there.http://api.jquery.com/addclass/Also, in your first section, you end one line with a comma instead of a semicolon, and there's no semicolon on the other line.When you put everything together instead of splitting it up into 3 pieces, this is what you're telling it to do:

  $( '.main2' ).addClass( 'bt_visible animated fadeInDownBig');  $('.main2').addClass(3000, 'animated fadeOutDownBig');  $( '.main2' ).addClass( 'bt_visible animated fadeInDownBig'); // this is the same as the first line  $( ".main2" ).toggle( "puff" ).delay(3000);  $( '.main2' ).addClass( 'bt_visible animated fadeInDownBig'); // the same line again  $( ".main2" ).removeClass( 'bt_visible animated fadeInDownBig').delay(3000);  $( '.main2' ).addClass( 'bt_visible animated fadeOutDownBig').delay(3000);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...