<div class="wrapper">
<!-- Header -->
<div class="header">
<div class="blur"></div>
<div class="nav">
<div><a href="#">About</a></div>
<div><a href="#">Work</a></div>
</div>
</div>
<!-- Background Image -->
<div class="hero">
<div class="background move-background hero-image"></div>
</div>
<!-- Center Text -->
<div class="move-background center">
<p class="no-select">GO AWAY</p>
</div>
</div>
html {
background-color: #fff;
overflow: hidden;
}
body {
font-family: "Oswald", sans-serif;
-webkit-font-smoothing: antialiased;
font-smoothing: antialiased;
}
.header {
width: 100%;
height: 60px;
position: fixed;
top: 0;
z-index: 1000;
}
.header .blur {
background-color: #171717;
opacity: .2;
filter: blur(1px);
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.header .nav {
width: 400px;
height: 100%;
position: absolute;
right: 0;
}
.nav div {
float: right;
height: 100%;
width: 90px;
text-align: center;
}
.header .nav a {
color: #fff;
font-family: "Open Sans", sans-serif;
line-height: 60px;
margin: 0 auto;
text-decoration: none;
letter-spacing: 1px;
font-size: 1.2em;
}
.header .nav div:hover {
background-color: rgba(23, 23, 23, 0.7);
}
div.center {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
border-radius: 50px;
text-align: center;
max-width: 80vmax;
max-height: 400px;
}
div.center > p {
color: #fecb1e;
font-size: 19vmax;
text-shadow: 0px 0px 7px #151716;
margin: 0;
line-height: 60vh;
}
div.wrapper {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
div.hero {
transform-style: preserve-3d;
backface-visibility: hidden;
position: relative;
display: block;
left: 0px;
top: 0px;
height: 100%;
width: 100%;
transform: translate3d(15px, 13px, 0px);
}
div.hero-image {
background: url(https://images.unsplash.com/photo-1471623432079-b009d30b6729?dpr=1&auto=compress,format&fit=crop&w=1199&h=799&q=80&cs=tinysrgb&crop=);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
position: absolute;
width: 108%;
height: 108%;
top: 50%;
left: 47%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
transition: all 1s linear;
}
.no-select {
cursor: default;
-webkit-user-select: none;
/* Chrome all / Safari all */
-moz-user-select: none;
/* Firefox all */
-ms-user-select: none;
/* IE 10+ */
user-select: none;
/* Likely future */
}
var prevX = 0;
var prevY = 0;
var posX = "-50%";
var posY = "-50%";
var movedUp = false;
var movedLeft = false;
// EVENT HANDLERS
$( ".move-background" ).hover(function( event ) {
prevX = event.pageX;
prevY = event.pageY;
}, null);
$( ".move-background" ).mousemove(function( event ) {
moveBackground(event);
});
// PARALLAX BACKGROUND EFFECT
function moveBackground( event ) {
directionMoved( event );
posX = (movedLeft) ? "-49%" : "-51%";
posY = (movedUp) ? "-49%" : "-51%";
$(".background").css({"-webkit-transform":"translate("+ posX + ","+posY+")"});
prevX = event.pageX;
prevY = event.pageY;
}
function directionMoved(event)
{
movedLeft = (prevX > event.pageX) ? true : false;
movedUp = (prevY > event.pageY) ? true : false;
}
This Pen doesn't use any external CSS resources.