Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a SetTimeout and transition to jQuery Show / Hide

I am trying to add a SetTimeout and animation type transition to jQuery Show / Hide call. Below is how I currently have it but am wanting to add the a specific amount of time the 'show' div remains displayed before it reverts back to the orginal #bg_dv. I also want to add animated transitions between the effects if possible.

   function tilt(){
    $("#area1").click(function(){
        $("#bg_div").hide();
        $("#bg_skew").show(); // I would like to show this Div for about 5 seconds
 // and then have original back. 
       });
    }
like image 978
fred randall Avatar asked Dec 12 '22 13:12

fred randall


1 Answers

$("#bg_div").hide(0).delay(5000).show(0);
$("#bg_skew").show(0).delay(5000).hide(0);

If you want animations, you can replace the calls to hide() and show() with something appropriate. For example fadeIn() and fadeOut().

like image 71
Rickard Andersson Avatar answered Dec 28 '22 01:12

Rickard Andersson