"b4ckgr0undf4d3"
Bootstrap 3.3.0 Snippet by okebro

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.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 ----------> <section id="wrapper" class="colorOne"> <header> Using Simple JS/jQuery and classes to get a cool transition effect on scroll. <h2>(On phone view in debug mode)</h2> </header> <article class="item"> <h1>01</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non varius nulla. Pellentesque sit amet sodales eros. Nam quis nibh vitae risus feugiat pulvinar vel eu est. Nam ex massa, rhoncus mattis est ac, iaculis vulputate nisl. Donec maximus nisi eu ipsum semper, eu euismod mi sodales. Nunc id felis sit amet sem faucibus placerat. Sed consectetur lectus metus, et ullamcorper nisi fermentum sit amet. Sed in volutpat magna, nec accumsan orci. Aenean turpis lectus, tincidunt nec diam et, condimentum scelerisque nisi. Aenean elementum neque eros, et interdum enim faucibus et. Cras eleifend interdum felis, non dignissim purus vulputate in. Suspendisse vel nunc dolor. Curabitur venenatis nisi non odio auctor, et malesuada odio tincidunt.</p> </article> <article class="item"> <h1>02</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non varius nulla. Pellentesque sit amet sodales eros. Nam quis nibh vitae risus feugiat pulvinar vel eu est. Nam ex massa, rhoncus mattis est ac, iaculis vulputate nisl. Donec maximus nisi eu ipsum semper, eu euismod mi sodales. Nunc id felis sit amet sem faucibus placerat. Sed consectetur lectus metus, et ullamcorper nisi fermentum sit amet. Sed in volutpat magna, nec accumsan orci. Aenean turpis lectus, tincidunt nec diam et, condimentum scelerisque nisi. Aenean elementum neque eros, et interdum enim faucibus et. Cras eleifend interdum felis, non dignissim purus vulputate in. Suspendisse vel nunc dolor. Curabitur venenatis nisi non odio auctor, et malesuada odio tincidunt.</p> </article> <article class="item"> <h1>03</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non varius nulla. Pellentesque sit amet sodales eros. Nam quis nibh vitae risus feugiat pulvinar vel eu est. Nam ex massa, rhoncus mattis est ac, iaculis vulputate nisl. Donec maximus nisi eu ipsum semper, eu euismod mi sodales. Nunc id felis sit amet sem faucibus placerat. Sed consectetur lectus metus, et ullamcorper nisi fermentum sit amet. Sed in volutpat magna, nec accumsan orci. Aenean turpis lectus, tincidunt nec diam et, condimentum scelerisque nisi. Aenean elementum neque eros, et interdum enim faucibus et. Cras eleifend interdum felis, non dignissim purus vulputate in. Suspendisse vel nunc dolor. Curabitur venenatis nisi non odio auctor, et malesuada odio tincidunt.</p> </article> <article class="item"> <h1>04</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non varius nulla. Pellentesque sit amet sodales eros. Nam quis nibh vitae risus feugiat pulvinar vel eu est. Nam ex massa, rhoncus mattis est ac, iaculis vulputate nisl. Donec maximus nisi eu ipsum semper, eu euismod mi sodales. Nunc id felis sit amet sem faucibus placerat. Sed consectetur lectus metus, et ullamcorper nisi fermentum sit amet. Sed in volutpat magna, nec accumsan orci. Aenean turpis lectus, tincidunt nec diam et, condimentum scelerisque nisi. Aenean elementum neque eros, et interdum enim faucibus et. Cras eleifend interdum felis, non dignissim purus vulputate in. Suspendisse vel nunc dolor. Curabitur venenatis nisi non odio auctor, et malesuada odio tincidunt.</p> </article> </section>
@import url(http://fonts.googleapis.com/css?family=Roboto:300,700); #wrapper{ width: 100%; height: 100%; font-family: 'Roboto', sans-serif; /*transition for the background color*/ -webkit-transition: background-color 500ms; -moz-transition: background-color 700ms; -o-transition: background-color 700ms; transition: background-color 700ms; } /*color classes to be applied to "#wrapper" by the js*/ .colorOne{ background-color: #BF3F3F; } .colorTwo{ background-color: #59A57F; } .colorThree{ background-color: black; } .colorFour{ background-color: #7FBF3F; } /*layout styles not really relevant to this demo*/ header{ width: 100%; color: white; background-color: #191919; text-align: center; padding: 1em 0 1em 0; margin-bottom: 100px; } h2{ font-size: .7em; padding-top: .5em; } .item{ width: 100%; max-width: 600px; margin: 0 auto; height: 650px; padding: 0px 0 10px 0; } h1{ color: white; display: inline-block; width: 32%; vertical-align: top; font-size: 10em; font-weight: 700; } p{ width: 64%; display: inline-block; color: white; line-height: 170%; font-size: .9em; font-weight: 300; } @media screen and (max-width: 550px) { h1{ display: block; width: 90%; margin-left: 3%; } p{ display: block; width: 90%; margin-left: 3%; } header{ margin-bottom: 30px; } }
/* this function will add different background color classes to "#wrapper" when the window is scrolled to a certain height. It will also remove the next color class so it reverts to the appropriate color when the user scrolls back up. Could be simplified, but this is easy to understand and alter. */ $(window).scroll(function() { if ($(this).scrollTop() <= 450) { $('#wrapper').addClass('colorOne') .removeClass('colorTwo'); } else if ($(this).scrollTop() <= 1000) { $('#wrapper').addClass('colorTwo') .removeClass('colorThree'); } else if ($(this).scrollTop() <= 1500) { $('#wrapper').addClass('colorThree') .removeClass('colorFour'); } else if ($(this).scrollTop() <= 1850) { $('#wrapper').addClass('colorFour') .removeClass('colorFive'); } else { $('#wrapper').addClass('colorOne') } });

Related: See More


Questions / Comments: