Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
    <meta charset="utf-8">
    <title>Slider</title>
  </head>
  <body>
    <header>
      <nav>
        <ul>
          <li><a href="#page-1">Page 1</a></li>
          <li><a href="#page-2">Page 2</a></li>
          <li><a href="#page-3">Page 3</a></li>
          <li><a href="#page-4">Page 4</a></li>
        </ul>
      </nav>
    </header>
    <section>
      <div class="page" id="page-1">Page 1</div>
      <div class="page" id="page-2">Page 2</div>
      <div class="page" id="page-3">Page 3</div>
      <div class="page" id="page-4">Page 4</div>
    </section>
  </body>
</html>
 
$(document).ready(function () {
  $(".page").css({
    height: $(window).height(),
    lineHeight: $(window).height() + "px"
  });
  $("nav a").click(function () {
    theHref = $(this).attr("href");
    $("html, body").animate({
      scrollTop: $(theHref).offset().top
    }, 500);
    return false;
  });
});
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers