Don't try to control two different time periods with one counter.
Use setTimeout() instead.
You can vary the fadePause variable for total visible time to display.Code:<html> <head> <title>Testimonials</title> <script type="text/javascript"> // From: http://www.webdeveloper.com/forum/showthread.php?p=1139291#post1139291 var Testimonials = [ ['“I was extremely hesitant to start, but the staff at AFS held my hand every step of the way,' +' and I am pleased with their service and results–“ <br>Lisa – CA'], ['“The negotiators at AFS were great! My program was completed 6 months early due to their successful negotiating!' +' Now I have NO debt!” <br>Michael – TX'], ['“Thanks to AFS, I now have $1200.00 in extra cash flow each month, FOR ME! - rather than it going to the creditors!' + ' It is a huge weight off of my shoulders!” <br>Thomas – FL'], ['“If you want or need to get out debt once and for all – This is the avenue to take!” <br>Jennifer – MA'], ['“I have tried everything over the past 5 years to eliminate my debt' +' – Utilizing a program through AFS actually helped me do it!” <br>Chris - AR'] // Note: no comma after last entry ]; var fileInx = 0; var fadeCnt = 0; var fadeInc = 5; var fadePause = 5; // constant of seconds to display without fade var PauseFade = 5; // variable to modify function dispTestimonialPause() { PauseFade--; if (PauseFade > 0) { setTimeout("dispTestimonialPause()",1000); } else { PauseFade = fadePause; setTimeout("dispTestimonial()",100); } } function dispTestimonial () { document.getElementById("testimonials").innerHTML = Testimonials[fileInx]; // +'<p>'+fadeCnt; document.getElementById('testimonials').style.opacity = (fadeCnt/100).toFixed(2); document.getElementById('testimonials').style.filter = 'alpha(opacity=' + fadeCnt + ')'; fadeCnt += fadeInc; var flag = false; if (fadeCnt >= 100) { fadeInc *= -1; flag = true; } if (fadeCnt <= 0) { fadeInc *= -1; fileInx++; fileInx = (fileInx % Testimonials.length); } if (flag) { setTimeout("dispTestimonialPause()",1000); } else { setTimeout("dispTestimonial()",100); } } window.onload = function () { setTimeout("dispTestimonial()", 100); } </script> </head> <body> <h3>Testimonials</h3> <div id="testimonials" style="width:200px;background:yellow"></div> </body> </html>
Good Luck!
![]()


Reply With Quote
Bookmarks