Solved

JQuery cycling list

Posted on 2014-03-30
3
296 Views
Last Modified: 2014-03-30
Hi all.

I'm wondering if someone can fix this issue.
Please refer to http://dev.delphicoding.com/appcdw_present.php.

You can see a blue shaded rounded rectangle with a dark-red caption where users' comments to my software should cycle one by one... but they cycle two by two!

I used this code found on the web:

		$('ul#comments li').hide();
		var i = 0;
		var delay = 3000; //millisecond delay between cycles
		function cycleThrough(){
			 var imax = $("ul#comments li").length -1;
			 $("ul#comments li:eq(" + i + ")")
					 .fadeIn(400)
					 .delay(delay)
					 .fadeOut(400, function(){
							 (i === imax) ? i=0 : ++i;
							 cycleThrough();
					 });
			 };

		cycleThrough();

Open in new window


Then, seeing the problem, I tried to write a new different code:

	$('ul#comments li').hide();
	var cycleThrough = function()
	{
		var el = $('ul#comments li:first');
		el.fadeIn(400)
			.delay(3000)
			.fadeOut(400)
			.parent().append(el);
	};
	setInterval(cycleThrough, 4000);

Open in new window


But the problem remains the same :( I can't see any wrong in the markup nor in styling, so I ask help to you.

This question is related to http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28400697.html

Thanks to all
0
Comment
Question by:Marco Gasi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39964852
Again, I think you are loading you event handler twice. Try loading your jquery first and then your custom script.
0
 
LVL 31

Author Closing Comment

by:Marco Gasi
ID: 39964858
Thanks
0
 
LVL 31

Author Comment

by:Marco Gasi
ID: 39964860
I put an explanation here for future readers: the problem has been fixed moving all links to external resource into the head section from the body, where Google suggested to put them in order to speed up the page.
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question