Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-22-2012, 05:32 PM   PM User | #1
dylanbaumannn
Regular Coder

 
Join Date: Feb 2012
Location: Nebraska, USA
Posts: 132
Thanks: 8
Thanked 19 Times in 19 Posts
dylanbaumannn is an unknown quantity at this point
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
dylanbaumannn is offline   Reply With Quote
Reply

Bookmarks

Tags
functions, jquery, jqueryloop, loop

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:12 PM.


Advertisement
Log in to turn off these ads.