www.webdeveloper.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 35

Thread: Fade Out Testimonials

  1. #16
    Join Date
    Feb 2010
    Posts
    13

  2. #17
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,263

    Question Some debugging required ...

    I'm not sure why this is happening.
    Let's do some investigation on your site.
    Make a temporary change to display the 'fileInx' value in the testimonial, like:
    Code:
      document.getElementById("testimonials").innerHTML = fileInx+'<p>'+Testimonials[fileInx];
    What is the value of 'fileInx' when the 'undefined' shows up?

  3. #18
    Join Date
    Feb 2010
    Posts
    13
    Alright the change is made.

    As I'm looking at this and reading through the java (more like fumbling through the java) I'm noticing that the value causing "undefined" is 5. There are only 5 testimonials in the array (I'm assuming they have values 0-4). What value is limiting the random number generating to a number between 0 and 5? Eventually I'll have more than 5-6 testimonials and I'll need to generate numbers that are larger than 5.

    EDIT: After looking through the code a bit more and some Googling, I changed the computation to the following:

    fileInx = Math.round(0+Math.random()*Testimonials.length);

    It works so far from what I can tell. Want to double check me? Maybe you have another trick up your sleeve?
    Last edited by bfurnace; 02-25-2010 at 08:42 PM.

  4. #19
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,263

    Consider this ...

    Actually you have only 4 testimonials (0,1,2, and 3).
    The problem is that you set the increment of fadeInc = 5;

    Change to
    Code:
    var fadeInc = Testimonials.length-1;
    Let us know if that's better as the link you provided before did not look like anything was changed.

    BTW, this is still 'javascript', not 'java'. The both start with the same 4 letters, but that the only thing they have in common.

  5. #20
    Join Date
    Feb 2010
    Posts
    13
    Quote Originally Posted by JMRKER View Post

    BTW, this is still 'javascript', not 'java'. The both start with the same 4 letters, but that the only thing they have in common.
    This statement sums up how little I know. I appreciate all the help as well as your patience! I THINK that fixed it. I'll let you know if it gives me anymore problems. Thanks again for the help!

  6. #21
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,263
    You're most welcome.
    Happy to help.
    Good Luck!


    BTW, is that Austin, Texas?
    My daughter recently move away, but we liked what we saw while she was there!

  7. #22
    Join Date
    Feb 2010
    Posts
    13
    Ahh!! I'm about ready to pull my hair out. It's still giving me a value of 5 occasionally.

    Yes, I am out of Austin, Texas and I love it here. Where did she move to?

  8. #23
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,263

    Lightbulb One more try ...

    Try changing this line ...
    Code:
        fileInx = Math.round(Math.random()*Testimonials.length);
    to ...
    Code:
        fileInx = Math.floor(Math.random()*Testimonials.length);
    She's currently in COLD Kansas City, MO, freezing her buns off.

  9. #24
    Join Date
    Feb 2010
    Posts
    13
    I can say, it finally works! Tell your daughter not to sweat it, we got 2 inches of snow here a few days ago.

  10. #25
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,263
    I'm glad it works for you.
    Stay warm.
    Good Luck!

  11. #26
    Join Date
    Jul 2010
    Posts
    5
    Tnx Guys, nice one!

    i have it running on my site: www.computerfields.com

    If you have some suggestions please let me know

  12. #27
    Join Date
    Feb 2011
    Posts
    4
    How can you make the text stay up for a couple of seconds before it fades out?

  13. #28
    Join Date
    Feb 2011
    Posts
    4
    Quote Originally Posted by Akki View Post
    Tnx Guys, nice one!

    i have it running on my site: www.computerfields.com

    If you have some suggestions please let me know
    I like the way your testimonials stay up for some time before fading and the fade is smooth can you share your settings for this script?

  14. #29
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,263

    Question

    Quote Originally Posted by evasey951 View Post
    How can you make the text stay up for a couple of seconds before it fades out?
    I'm not sure I understand the question.

    A previous link by "Akki" has a delay before the change.
    What do you want to do differently?
    What code are you using? Show us your problem.

  15. #30
    Join Date
    Feb 2011
    Posts
    4
    Quote Originally Posted by JMRKER View Post
    I'm not sure I understand the question.

    A previous link by "Akki" has a delay before the change.
    What do you want to do differently?
    What code are you using? Show us your problem.
    I added the script to Advantage-fs.com but it fades in then out before you can read the testimonials, i changed the fadeinc variable but i am sure i am just missing a line to add a pause or something. here is the code (pretty much identical to the first version)

    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–“ 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!” 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!” Thomas – FL'],
    ['“If you want or need to get out debt once and for all – This is the avenue to take!” 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!” Chris - AR']
    // Note: no comma after last entry
    ];

    var fileInx = 0;
    var fadeCnt = 0;
    var fadeInc = 3;

    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;
    if (fadeCnt >= 100) { fadeInc *= -1; }
    if (fadeCnt <= 0) {
    fadeInc *= -1;
    fileInx++;
    fileInx = (fileInx &#37; Testimonials.length);
    }
    }

    window.onload = function () {
    dispTestimonial()
    setInterval("dispTestimonial()", 100);
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles