"auto scroll"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/rachel_web/pen/ORXXKO?depth=everything&limit=all&order=popularity&page=2&q=single+page&show_forks=false" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <style class="cp-pen-styles">body { font-family: 'Open Sans', sans-serif; font-weight: 300; margin: 0; padding: 0 15px 30px 15px; box-sizing: border-box; background: #F3F3F3; } body .static-header { max-width: 900px; overflow: hidden; box-sizing: border-box; margin: 20px auto; text-align: center; } body .static-header img { margin: 0 auto; } body .static-header nav { padding: 20px 0 0; max-width: 400px; margin: 0 auto; } body .static-header nav a { display: inline-block; color: #666666; text-decoration: none; font-size: 14px; cursor: pointer; } body .static-header nav a:not(:last-of-type) { padding-right: 30px; } body .static-header nav a:hover { color: #333333; } body .fixed-header { display: none; position: fixed; top: 0; background: #FFFFFF; margin: 0 -15px; width: 100%; border-bottom: 1px solid #CCCCCC; box-sizing: border-box; box-shadow: 0px 0px 10px 0 rgba(0, 0, 0, 0.5); opacity: 0.9; z-index: 100; } body .fixed-header .fheader__container { max-width: 900px; padding: 15px 30px; margin: 0 auto; overflow: hidden; box-sizing: border-box; } body .fixed-header .fheader__container img { float: left; height: 30px; width: auto; } body .fixed-header .fheader__container nav { padding: 5px 0; max-width: 400px; float: right; text-align: right; } body .fixed-header .fheader__container nav a { display: inline-block; color: #666666; text-decoration: none; font-size: 14px; cursor: pointer; } body .fixed-header .fheader__container nav a:not(:last-of-type) { padding-right: 15px; } body .fixed-header .fheader__container nav a:hover { color: #333333; } body .container__content { margin: 0 auto; max-width: 900px; background: rgba(255, 255, 255, 0.8); box-sizing: border-box; min-height: 1000px; overflow: hidden; padding: 15px; clear: both; } body .container__content > div { min-height: 500px; display: block; overflow: hidden; } body .container__content > div h1 { text-align: center; line-height: 500px; color: #666666; margin: 0; } body .container__content > div.section1 { background: #ffd6cd; } body .container__content > div.section2 { background: #ddebfd; } body .container__content > div.section3 { background: #ffd6cd; } body .container__content > div.section4 { background: #ddebfd; } </style></head><body> <header class="static-header"> <img src="http://nickaburress.com/images/codepen.png" height="100" height="auto"/> <nav> <a href="#section1">Section 1</a> <a href="#section2">Section 2</a> <a href="#section3">Section 3</a> <a href="#section4">Section 4</a> </nav> </header> <header class="fixed-header"> <div class="fheader__container"> <img src="http://nickaburress.com/images/codepen.png" width="30px" height="auto"/> <nav> <a href="#section1">Section 1</a> <a href="#section2">Section 2</a> <a href="#section3">Section 3</a> <a href="#section4">Section 4</a> </nav> </div> </header> <div class="container__content"> <div id="section1" class="section1"> <h1>Section 1</h1> </div> <div id="section2" class="section2"> <h1>Section 2</h1> </div> <div id="section3" class="section3"> <h1>Section 3</h1> </div> <div id="section4" class="section4"> <h1>Section 4</h1> </div> </div> <footer> </footer> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script >$(document).ready(function(){ $('a[href^="#"]').on('click',function (e) { e.preventDefault(); var target = this.hash; var $target = $(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 900, 'swing', function () { window.location.hash = target; }); }); }); $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 200) { $(".fixed-header").slideDown(); } else { $(".fixed-header").slideUp(); } }); //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: