Skip to content

Commit

Permalink
End of Video 2 - Parallax Header
Browse files Browse the repository at this point in the history
  • Loading branch information
travisneilson committed Apr 3, 2015
1 parent 1b79e90 commit dd04ee1
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 2 deletions.
44 changes: 44 additions & 0 deletions css/layout1.sass
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,47 @@ img


// Parallax
.bird-box
position: relative
height: 600px
background:
image: url(/images/bird-bg.jpg)
size: auto 600px
position: top center
attachment: fixed
overflow: hidden

.logo
height: 100px
width: 100%
background:
image: url(/images/black-bird-logo.svg)
position: center
repeat: no-repeat
position: absolute
top: 50%
margin-top: -50px

.fore-bird
width: 960px
height: 733px
background:
image: url(/images/fore-bird.png)
repeat: no-repeat
position: right bottom
position: absolute
left: 50%
margin-left: -480px
top: 380px

.back-bird
width: 960px
height: 298px
background:
image: url(/images/back-bird.png)
repeat: no-repeat
position: top left
position: absolute
left: 50%
margin-left: -480px
40 changes: 40 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -874,3 +874,43 @@ figure {

img {
max-width: 100%; }

.bird-box {
position: relative;
height: 600px;
background-image: url(/images/bird-bg.jpg);
background-size: auto 600px;
background-position: top center;
background-attachment: fixed;
overflow: hidden; }

.logo {
height: 100px;
width: 100%;
background-image: url(/images/black-bird-logo.svg);
background-position: center;
background-repeat: no-repeat;
position: absolute;
top: 50%;
margin-top: -50px; }

.fore-bird {
width: 960px;
height: 733px;
background-image: url(/images/fore-bird.png);
background-repeat: no-repeat;
background-position: right bottom;
position: absolute;
left: 50%;
margin-left: -480px;
top: 380px; }

.back-bird {
width: 960px;
height: 298px;
background-image: url(/images/back-bird.png);
background-repeat: no-repeat;
background-position: top left;
position: absolute;
left: 50%;
margin-left: -480px; }
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
<link rel="icon" type="image/png" href="images/favicon.png">
</head>
<body>
<header class="bird-box">
<div class="back-bird"></div>
<div class="logo"></div>
<div class="fore-bird"></div>
</header>
<section class="content">
<article>
<h1>Clothing Store</h1>
Expand Down
8 changes: 6 additions & 2 deletions index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ html(lang="en")
link(rel="icon", type="image/png", href="images/favicon.png")

body

header.bird-box
.back-bird
.logo
.fore-bird




section.content

article
Expand Down
17 changes: 17 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$(window).scroll(function(){

var wScroll = $(this).scrollTop();

$('.logo').css({
'transform' : 'translate(0px, '+ wScroll /2 +'%)'
});

$('.back-bird').css({
'transform' : 'translate(0px, '+ wScroll /4 +'%)'
});

$('.fore-bird').css({
'transform' : 'translate(0px, -'+ wScroll /40 +'%)'
});

});
19 changes: 19 additions & 0 deletions js/min/functions-min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(window).scroll(function(){

var wScroll = $(this).scrollTop();

$('.logo').css({
'transform' : 'translate(0px, '+ wScroll /2 +'%)'
});

$('.back-bird').css({
'transform' : 'translate(0px, '+ wScroll /4 +'%)'
});

$('.fore-bird').css({
'transform' : 'translate(0px, -'+ wScroll /40 +'%)'
});

});


0 comments on commit dd04ee1

Please sign in to comment.