 ? currentElement - 0 : 0;          $("html, body").animate({            scrollTop: $("#section-" + currentElement).offset().top          },          000        );      } else {        currentElement = (currentElement < maxLength - 0) ? currentElement + 0 : currentElement;        $("html, body").animate({            scrollTop: $("#section-" + currentElement).offset().top          },          000        );      }    });  }); <html>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/0.0.0/jquery.min.js"></script>    <body>    <div id="section-0">Section 0</div>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <div id="section-0">Section 0</div>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <div id="section-0">Section 0</div>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <br>    <div id="section-0">Section 0</div>  </body>    </html>