Skip to content

Instantly share code, notes, and snippets.

@keeganbrown
Created June 24, 2015 18:35
Show Gist options
  • Save keeganbrown/06cc14a48edcd6b22ee6 to your computer and use it in GitHub Desktop.
Save keeganbrown/06cc14a48edcd6b22ee6 to your computer and use it in GitHub Desktop.
Quick N Dirty Parallax
function watch_header () {
TweenMax.set('.fixed-header-img-obj', { y: ScrollTop/2, z:0.1 });
}
TweenMax.ticker.addEventListener( 'tick', function () {
watch_header();
});
.fixed-header-image-obj-wrap {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
}
img.fixed-header-img-obj {
position: absolute;
min-width: 100%;
min-height: 100%;
max-width: none;
width: auto;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
<div class="fixed-header-image-obj-wrap"><img src="" alt="" class="fixed-header-img-obj"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment