JSFiddle - React, Tailwind, and code Playground
HTML
<div class="site-div">
<div class="banner">
<div class="banner-title"><h1>Zipper Effect</h2></div>
</div>
</div>
<!-- ZIPPER -->
<div id="containerZipper">
<canvas id="canvasback"></canvas>
<canvas id="canvas"></canvas>
<canvas id="overlapcanvas"></canvas>
</div>
<!-- END ZIPPER -->
CSS
/*
* Developer : Claudio Ferraro ([email protected])
* Date : 26/03/2013
* All code (c)2013 Sunbyte inc. all rights reserved
*/
/* CANVAS */
#containerZipper {
width: 100%;
height: 100%;
}
#canvasback {
position: absolute;
z-index: 998;
}
#canvas {
position: absolute;
z-index: 999;
}
#overlapcanvas {
position: absolute;
z-index: 1000;
}
/* SITE */
html, body {
height: 100%
}
body {
background-color: #ccc;
padding: 0;
margin: 0;
overflow: hidden;
}
input[type=radio] {
background: white;
color: yellow;
-webkit-appearance: none;
width: 10px;
height: 10px;
}
input[type=radio]:checked {
background: black;
}
h1 {
font-family: helvetica;
font-size: 90px;
color: white;
text-shadow: 4px 4px 6px #000;
margin: 0;
}
h2 {
font-family: helvetica;
font-size: 44px;
color: white;
text-shadow: 2px 2px 3px #000;
margin: 0;
}
h3 {
font-family: helvetica;
font-size: 20px;
color: white;
margin: 0;
text-transform: uppercase;
}
h4 {
font-family: verdana;
font-size: 14px;
color: darkgray;
margin: 0;
padding-left: 10px;
}
h4.first {
padding-left: 0px !important;
}
.site-div {
position: absolute;
z-index: 1;
width: 100%;
}
.header {
position: relative;
height: 105px;
background-color: #ccc;
}
.header-band {
overflow: hidden;
position: absolute;
width: 100%;
bottom: 5px;
height: 51px;
background: url('../img/01.png');
}
.banner {
text-align: center;
position: relative;
height: 500px;
width: 100%;
background: url('../img/background.jpg');
background-position: center center;
}
.banner-title {
position: relative;
top: 20px;
}
.bannerback {
height: 100%;
z-index: -1
}
.footer {
height: 50px;
background-color: #ccc;
}
/* PALETTE */
.palette-div {
text-align: center;
padding: 0;
margin: 0;
position:...
JavaScript
/*
* Developer : Claudio Ferraro ([email protected])
* Date : 26/03/2013
* All code (c)2013 Sunbyte inc. (Latvia) all rights reserved
* Version: 1.01
*
wfwjhfwkufhwufhwukfhkwuhrthrhrehe5h
hrgrewhge
rgheqrgg
hg
g
eh
rg
he
erw
hgwrhr
hgwergeqg
rwegheg
hew
hehgr
eqghewrg
$(window).resize(function() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(reinit, 100);
});
function reinit() {
// reinit if resizing
var ZipperContainer = curveCanvas.parentNode;
if (ZipperContainer.tagName == 'BODY') {
containerWidth = window.innerWidth;
containerHeight = window.innerHeight;
} else {
containerWidth = ZipperContainer.offsetWidth;
containerHeight = ZipperContainer.offsetHeight;
}
CurveLeft = (containerWidth / 2) - scrollBarWidth;
CurveLength = containerHeight - 40;
clearRect(ctx, 0, 0, null, null);
clearRect(ctxOver, 0, 0, null, null);
clearRect(ctxBack, 0, 0, null, null);
init();
};
function init() {
ctx = document.getElementById('canvas').getContext('2d');
ctxOver = document.getElementById('overlapcanvas').getContext('2d');
ctxBack = document.getElementById('canvasback').getContext('2d');
ctx.scale(1.0, 1.0);
ctxOver.scale(1.0, 1.0);
curveCanvas = document.getElementById('canvas');
baseCanvas = document.getElementById('overlapcanvas');
backCanvas = document.getElementById('canvasback');
var ZipperContainer = curveCanvas.parentNode;
if (ZipperContainer.tagName == 'BODY') {
containerWidth = window.innerWidth;
containerHeight = window.innerHeight;
} else {
containerWidth = ZipperContainer.offsetWidth;
containerHeight = ZipperContainer.offsetHeight;
}
if (isTouchSupported) {
baseCanvas.addEventListener('touchstart', myDown);
baseCanvas.addEventListener('touchend', myUp);
baseCanvas.addEventListener('touchmove', myMove);
baseCanvas.onmousedown = myDown;
...