Forked from pascalmaddin/parallax-image-with-text.html
Last active
August 29, 2015 14:12
-
-
Save salipro4ever/95f2e62e9d1036560029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="banner"> | |
| <div class="wrap-center"> | |
| <div class="banner-centered" id="banner-text"> | |
| <h2>Hello <strong>We Are Company-Name</strong>, Glad To See You. :-)</h2> | |
| </div> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function scrollBanner() { | |
| $(document).scroll(function(){ | |
| var scrollPos = $(this).scrollTop(); | |
| $('#banner-text').css({ | |
| 'top' : (scrollPos/3)+'px', | |
| 'opacity' : 1-(scrollPos/510) | |
| }); | |
| $('#banner').css({ | |
| 'background-position' : 'center ' + (-scrollPos/2)+'px' | |
| }); | |
| }); | |
| } | |
| scrollBanner(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #banner { | |
| margin-bottom: 50px; | |
| overflow: hidden; | |
| width: 100%; | |
| height: 500px; | |
| position: relative; | |
| clear: both; | |
| background: transparent url(path/to/image/1.jpg) center center no-repeat fixed; | |
| -webkit-background-size: cover; | |
| -moz-background-size: cover; | |
| -o-background-size: cover; | |
| background-size: cover; | |
| filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='path/to/image/1.jpg',sizingMethod='scale'); | |
| -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='path/to/image/1.jpg',sizingMethod='scale')"; | |
| } | |
| .wrap-center{ | |
| margin: 0 auto; | |
| position: relative; | |
| max-width: 73.231em; | |
| } | |
| .banner-centered { | |
| text-align: center; | |
| position: absolute; | |
| display: block; | |
| max-width: 75.231em; | |
| height: inherit; | |
| overflow: hidden; | |
| margin-top: 100px; | |
| } | |
| .banner-centered h2 { | |
| font-size: 5.385em; | |
| line-height: 1.5; | |
| text-transform: uppercase; | |
| letter-spacing: 2px; | |
| color: #fafafa; | |
| font-weight: 100; | |
| display: block; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment