Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Feb 2012
    Location
    Nebraska, USA
    Posts
    132
    Thanks
    8
    Thanked 19 Times in 19 Posts

    Problem getting Function to loop

    Hello!

    I'm working on a simple jQuery banner-ad for a client and the animations are as follows:
    1. Image fadein
    2. div fadein
    3. div fadeout
    4. Image fadeout


    1. Image2 fadein
    2. div2 fadein
    3. div2 fadeout
    4. Image2 fadeout

    Then i need it to loop.


    I currently have all the javascript and HTML/CSS to get the animations to display correctly.
    However I can't seem to get the darned thing to LOOP correctly! Here is the code I'm currently using:

    HTML
    Code:
    <div id="sliderContainer">
    
    	<div id="surgCont">
        	<div class="part1">
                <div class="quote1"></div>
            </div>
        </div><!--/surgCont-->
        
        <div id="careCont">
        	<div class="part1">
                <div class="quote1"></div>
            </div>
        </div><!--/careCont-->
    
    </div><!--/sliderContainer-->
    jQuery
    Code:
    $(function(){
    	function runIt(){
    		//Surg
    		//fadein
    		$('div#surgCont').animate({opacity: 1}, 1000);
    			//fadein
    			$('div#surgCont>.part1>.quote1')
    				.delay(1000)
    			//fadeout
    			$('div#surgCont>.part1>.quote1')
    			        .delay(4500)
    				.animate({opacity:0},1000);
                    //fadeout
    		$('div#surgCont').delay(13000).animate({opacity: 0}, 1000);
    	
    		//Care
    		//fadein
    		$('div#careCont').delay(14000).animate({opacity: 1}, 1000);
    			//fadein
    			$('div#careCont>.part1>.quote1')
    				.delay(15000)
    				.animate({opacity:1},1000);
    			//fadeout
    			$('div#careCont>.part1>.quote1')
    				.delay(4500)
    				.animate({opacity:0},1000);
                   //fadeout
    	       $('div#careCont').delay(13000).animate({opacity: 0}, 1000);	
             }//runit
    	runIt();
    });
    Any help would be greatly appreciated!
    Last edited by dylanbaumannn; 05-22-2012 at 05:47 PM. Reason: Simplified code


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •