Blank Slide in Javascript Slideshow

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

I am new to javascript. I found this code online and implemented it. It works fine except it adds a blank image at the end of the slideshow. Can someone advise how to eliminate the blank?

JSfiddle: https://jsfiddle.net/ndd9ye3t/#&togetherjs=eQtCJBj9Pd

 

in progress 0
JavaScript 1 week 5 Answer 313 views 0

About Animal

Answers ( 5 )

  1. ritwik

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    You may reduce the value of imgDuration to a lower value like 1000 and see the difference.

  2. Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    You might define slides as slides = slider.children; instead of childNodes since the latter contains a new line character too. That is the 3rd item in the array and that item couses the blank slide.
    w3schools says:
    The difference between this property and childNodes, is that childNodes contain all nodes, including text nodes and comment nodes, while children only contain element nodes.

    • Please briefly explain why you feel this answer should be reported .

      Report
      Cancel

      Thanks. That worked.

      • w3r

        Please briefly explain why you feel this answer should be reported .

        Report
        Cancel

        Thanks for participating in our “Learn & share programming knowledge” section. As you see one of the answers is helpful, mark that particular answer as best answer. This is both your privilege and duty as a user who asked the question.

  3. Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    hi
    try
    if (curIndex === (slides.length)) {
    curIndex = 1;
    }

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>