JSFiddle - React, Tailwind, and code Playground
by DJS Baker
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<div id="content">
<div id="up-left">
<div class="box snap white">
<h1>ONE</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box snap black">
<h1>TWO</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box snap white">
<h1>THREE</h1> <a class="more" href="" title=""></a>
</div>
<div class="box snap black">
<h1>FOUR</h1> <a class="more" href="" title=""></a>
</div>
<div class="box snap white">
<h1>FIVE</h1> <a class="more" href="" title=""></a>
</div>
<div class="box snap black six">
<h1>SIX</h1> <a class="more" href="" title=""></a>
</div>
</div>
<div id="down-right">
<div class="box black">
<h1>ONE</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box white">
<h1>TWO</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box black">
<h1>THREE</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box white">
<h1>FOUR</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box black">
<h1>FIVE</h1>
<a class="more" href="" title=""></a>
</div>
<div class="box white">
<h1>SIX</h1>
<a class="more" href="" title=""></a>
</div>
</div>
</div>
<script>
function crisscross() {
$('up-left').style.bottom = '-' + window.scrollY + 'px';
$('down-right').style.bottom = '-' + window.scrollY + 'px';
}
window.onscroll = crisscross;
</script>
CSS
div#content {
width: 100%;
height: 100%;
position: absolute;
top:0;
right:0;
bottom:0;
left:0;
}
h1 {
margin: 0;
padding: 0;
color:#fff
}
.box {
position: relative;
width: 100%;
height: 500px;
display: block;
margin: 0;
padding: 0;
}
.black {
background: black;
}
.white {
background: grey;
}
div#up-left {
position:absolute;
z-index:4px;
left: 0;
top: 0;
width: 50%;
margin: 0;
padding: 0;
}
div#down-right {
position:fixed;
bottom: 0px;
z-index: 5px;
left: 50%;
width: 50%;
margin: 0;
padding: 0;
}
JavaScript
jQuery.noConflict();
jQuery(function ($) {
var bgHeight = 2000,
upleft = $('#up-left'),
downright = $('#down-right'),
$window = $(window),
$body = $('body');
$('body').height(bgHeight + $window.height());
$window.scroll(function () {
if ($window.scrollTop() >= $body.height()-$window.height()) {
console.log($window.scrollTop(),downright.children().last().get(0));
downright.children().first().clone().appendTo(upleft);
downright.children().first().remove();
upleft.children().first().clone().appendTo(downright);
upleft.children().first().remove();
$window.scrollTop($window.height());
} else if ($window.scrollTop() == 0) {
console.log('--',$window.scrollTop());
$window.scrollTop($body.height());
}
});
$(window).resize(function () {
$body.height(bgHeight + $window.height());
});
});