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

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 03-18-2013, 05:33 AM   PM User | #1
cm123077
New Coder

 
Join Date: Aug 2012
Posts: 83
Thanks: 4
Thanked 0 Times in 0 Posts
cm123077 is an unknown quantity at this point
Change animate to fade in/fade out with delay

I am very new to JQuery, as far as coding goes. I have some code that slides some content in from right to left, seen here:

http://biostreamcompost.com/press/


I want this to fade in, stay visible for a short time, then fade back out, then the next piece of content does the same, forever. I have tried to change the code with little success. At this point, I am asking for some help so I can see how this is done, which will help me out a lot in the future.

Here is an example of how this should look (small "more news" section below the image)

http://fiverr.com/news

And, the code I am working with:

Code:
// start the rotation interval
	if(auto_rotate)
	 var rotatorInterval = setInterval(function(){wppr_interval()},post_rotator_speed);
	
	// next slide
	function wppr_interval(){
	  r_pointer++;
	  if(r_pointer == post_rotator_arr.length)
	  {
	    r_pointer = 0;
	    $("#rotator_prop").animate({"left":"0"},500);
	  }
	  else
	    $("#rotator_prop").animate({"left":"-=100%"},250);
	}
	
	// previous slide
	function wppr_back(){
	  r_pointer--;
	  if(r_pointer < 0)
	  {
	   r_pointer = post_rotator_arr.length - 1;
	   var to_last_rotater = "-=" + (100 * (r_pointer)) + "%";
	   $("#rotator_prop").animate({"left" : to_last_rotater},500);
	  }
	  else
	    $("#rotator_prop").animate({"left" : "+=100%"},500,
		function(){
		  if(auto_rotate)
		    rotatorInterval = setInterval(function(){
			  wppr_interval()},post_rotator_speed);
		});
	}
There is more code int he file (not too much), but I believe this is the bit that I need to focus on. Please help me out, if you can.

Thanks
__________________
BioStream
http://biostreamcompost.com
cm123077 is offline   Reply With Quote
Old 03-19-2013, 05:06 AM   PM User | #2
cm123077
New Coder

 
Join Date: Aug 2012
Posts: 83
Thanks: 4
Thanked 0 Times in 0 Posts
cm123077 is an unknown quantity at this point
Any thoughts on this? Nothing I have tried since the post has worked without some type of issue.
__________________
BioStream
http://biostreamcompost.com
cm123077 is offline   Reply With Quote
Old 03-20-2013, 04:30 AM   PM User | #3
cm123077
New Coder

 
Join Date: Aug 2012
Posts: 83
Thanks: 4
Thanked 0 Times in 0 Posts
cm123077 is an unknown quantity at this point
figured it out. Here is the solution.

Code:
// start the rotation interval
	if(auto_rotate)
	 var rotatorInterval = setInterval(function(){wppr_interval()},post_rotator_speed);
	
	// next slide
	function wppr_interval(){
	  r_pointer++;
	  if(r_pointer == post_rotator_arr.length)
	  {
	    r_pointer = 0;
	    $("#rotator_prop").fadeOut(200);
	    $("#rotator_prop").delay(200).animate({"left":"0"},500, function(){
		$(this).fadeIn(200);
	    });
	  }
	  else {
	    $("#rotator_prop").fadeOut(200);
	    $("#rotator_prop").animate({"left":"-=100%"},250, function(){
		$(this).fadeIn(200);
	    });
	}}

	// previous slide
	function wppr_back(){
	  r_pointer--;
	  if(r_pointer < 0)
	  {
	   r_pointer = post_rotator_arr.length - 1;
	   var to_last_rotater = "-=" + (100 * (r_pointer)) + "%";
	   $("#rotator_prop").fadeOut(200);
	   $("#rotator_prop").delay(200).animate({"left" : to_last_rotater},500, function(){
		$(this).fadeIn(200);
	   });
	  }
	  else {
	    $("#rotator_prop").fadeOut(200);
	    $("#rotator_prop").delay(200).animate({"left" : "+=100%"},500,
		function(){
		  $(this).fadeIn(200);
		  if(auto_rotate)
		    rotatorInterval = setInterval(function(){
			  wppr_interval()},post_rotator_speed);
		});
	}}
__________________
BioStream
http://biostreamcompost.com
cm123077 is offline   Reply With Quote
Reply

Bookmarks

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 06:13 AM.


Advertisement
Log in to turn off these ads.