JSFiddle - React, Tailwind, and code Playground
by funkwurm
HTML
<div id="body">
<div id="sectionA" class="div">First section</div>
<div id="sectionB" class="div">Second section</div>
<div id="sectionC" class="div">Third section
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
<div id="footer">
<div class="div cf">Footer</div>
</div>
</div>
CSS
* {
margin: 0;
padding: 0
}
body {
background-color: #800000
}
/* clear fix */
cf:after {
visibility:hidden;
display:block;
content:"";
clear:both;
height:0;
}
* html .cf {
zoom:1
}
/* IE6 */
*:first-child+html .cf {
zoom:1
}
/* IE7 */
.div {
height: 500px;
width: 100%;
display: block;
position: relative;
}
#sectionA {
background-color: #ABFF8F;
}
#sectionB {
background-color: #FFDF80;
}
#sectionC {
background-color: #A8E9FF;
height: 100px !important;
z-index: 1;
}
#footer {
position:fixed;
bottom:0;
overflow:hidden;
width:100%;
height:0;
background-color: #666;
color: #fff;
font-weight: bold;
font-size: 2em;
z-index: 10;
}
.box {
width:50px;
margin: 0 20px 20px 0;
height: 50px;
display: block;
background-color: #f2f2f2;
float: left;
}
JavaScript
var $window = jQuery(window),
$footer = jQuery("#footer"),
$viewport = window.innerHeight,
$maxscroll = ($('#body').height()-$viewport);
$startEffect = $footer.offset().top - $viewport;
function footerParallax() {
if ($window.scrollTop() > $maxscroll/2) {
$('#footer').height((($window.scrollTop()/$maxscroll)-.5)*2*$viewport);
} else {
$('#footer').height(0);
}
}
$window.scroll(footerParallax);