Click here to Skip to main content
15,891,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to do FadeIn and FadeOut of div using javascript and it must be in continue process after particular seconds. (time intervals).
Posted
Comments
phil.o 24-Oct-13 4:27am    
Nice requirement! What have you tried?

For that you can use below mentioned jQuery fadeIn() and fadeOut() methods.

XML
<script>
$( "a" ).click(function() {
  $( "div" ).fadeIn( 3000, function() {
    $( "span" ).fadeIn( 100 );
  });
  return false;
});
</script>


Check for Live Demo : jsfiddle

For more info check this : fadeIn

fadeOut

I hope this will help to you.
 
Share this answer
 
v4
Comments
NagarajDJ 24-Oct-13 4:31am    
Thank you sampath, but i want it in page load and it must repeat the effects
Sampath Lokuge 24-Oct-13 4:35am    
Try to use above methods according to your situation and let me know if you have specific problem there.
XML
<script type='text/javascript'>

        $(document).ready(function () {
            fadeIn_();
        })

        function fadeIn_() {
            $('#slog1').fadeIn(2000,
        function () {
            setTimeout("$('#slog1').fadeOut(2500); fadeOut_();", 6000);
        })
        }

        function fadeOut_() {
            $('#slog2').fadeIn(2000,
        function () {
            setTimeout("$('#slog2').fadeOut(2500); fadeIn_();", 6000);
        })
        }
    </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900