Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <section class="dark" style="background:url('http://www.mccullagh.org/db9/10d-2/new-york-city-at-night.jpg') no-repeat fixed;background-size:cover;">
- <div class="brdr_out">
- <div class="brdr_in">
- <div class="content" style="height:10em;margin-top:-5em;">
- <div class="title1">TITLE 1</div>
- </div>
- </div>
- </div>
- </section>
- <section class="light" style="background:url('http://images.nationalgeographic.com/wpf/media-live/photos/000/004/cache/african-elephant_435_600x450.jpg') no-repeat fixed;background-size:cover;">
- <div class="brdr_out">
- <div class="brdr_in">
- <div class="content" style="height:10em;margin-top:-5em;">
- <div class="title2">Title 2</div>
- <div class="title3">Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </div>
- </div>
- </div>
- </div>
- </section>
- body, html
- {
- height: 100%;
- }
- body
- {
- font-size: 16px;
- margin: 0;
- }
- .brdr_in, .brdr_out
- {
- bottom: 0;
- height: auto;
- left: 0;
- position: absolute;
- right: 0;
- top: 0;
- }
- .brdr_in
- {
- margin: .25em;
- padding: 1em;
- }
- .brdr_out
- {
- margin: 1em;
- padding: .25em;
- }
- .clr1, .dark
- {
- color: #fff;
- }
- .clr2, .light
- {
- color: #000;
- }
- .dark .brdr_in
- {
- border: 3px solid #d5d7a1;
- }
- .dark .brdr_out
- {
- border: 5px solid #d5d7a1;
- }
- .light .brdr_in
- {
- border: 3px solid #000;
- }
- .light .brdr_out
- {
- border: 5px solid #000;
- }
- section
- {
- height: 100%;
- position: relative;
- text-align: center;
- }
- section .content
- {
- position: absolute;
- top: 50%;
- width: 100%;
- }
- .title1, .title2
- {
- display: inline-block;
- letter-spacing: .25em;
- line-height: 1.875em;
- padding-bottom: .8em;
- }
- .title2
- {
- border-bottom: 1px solid #4a4639;
- margin-bottom: 3em;
- }
- $(window).on('scroll', function(){
- var slide_distance = window.scrollY / 1000, slide = Math.floor(slide_distance)
- var color = color_interp(slide_colors[slide], slide_colors[slide + 1], slide_distance - slide)
- $('#border').css('color', color)
- })
- <section class="dark" style="background:url('http://www.mccullagh.org/db9/10d-2/new-york-city-at-night.jpg') no-repeat fixed;background-size:cover;">
- <div class="content" style="height:10em;margin-top:-5em;">
- <div class="title1">TITLE 1</div>
- </div>
- </section>
- <section class="light" style="background:url('http://images.nationalgeographic.com/wpf/media-live/photos/000/004/cache/african-elephant_435_600x450.jpg') no-repeat fixed;background-size:cover;">
- <div class="content" style="height:10em;margin-top:-5em;padding:0 20%;width:60%">
- <div class="title2">Title 2</div>
- <div class="title3">Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </div>
- </div>
- </section>
- <div id="top" style="background:url('http://www.mccullagh.org/db9/10d-2/new-york-city-at-night.jpg') no-repeat fixed;background-size:cover;display:none;height:24px;position:fixed;top:0;left:0;right:0;z-index:3;"></div>
- <div id="bottom" style="background:url('http://images.nationalgeographic.com/wpf/media-live/photos/000/004/cache/african-elephant_435_600x450.jpg') no-repeat fixed;background-size:cover;display:none;height:24px;position:fixed;bottom:0;left:0;right:0;z-index:3;"></div>
- <div class="brdr_out">
- <div class="dark">
- <div class="top"></div>
- <div class="right"></div>
- <div class="bottom"></div>
- <div class="left"></div>
- </div>
- <div class="light">
- <div class="top"></div>
- <div class="right"></div>
- <div class="bottom"></div>
- <div class="left"></div>
- </div>
- </div>
- <div class="brdr_in">
- <div class="dark">
- <div class="top"></div>
- <div class="right"></div>
- <div class="bottom"></div>
- <div class="left"></div>
- </div>
- <div class="light">
- <div class="top"></div>
- <div class="right"></div>
- <div class="bottom"></div>
- <div class="left"></div>
- </div>
- </div>
- body, html
- {
- height: 100%;
- }
- body
- {
- font-size: 16px;
- margin: 0;
- }
- .clr1, .dark
- {
- color: #fff;
- }
- .clr2, .light
- {
- color: #000;
- }
- section
- {
- height: 100%;
- position: relative;
- text-align: center;
- }
- section .content
- {
- position: absolute;
- top: 50%;
- width: 100%;
- }
- .title1, .title2
- {
- display: inline-block;
- letter-spacing: .25em;
- line-height: 1.875em;
- padding-bottom: .8em;
- }
- .title2
- {
- border-bottom: 1px solid #4a4639;
- margin-bottom: 3em;
- }
- /*The Frame Styles*/
- .brdr_in .bottom
- {
- bottom: 24px;
- }
- .brdr_in .bottom, .brdr_in .top
- {
- height: 3px;
- left: 24px;
- right: 24px;
- }
- .brdr_in .dark div, .brdr_out .dark div
- {
- background-color: #e4d7b0;
- }
- .brdr_in div, .brdr_out div
- {
- position: fixed;
- z-index: 4;
- }
- .brdr_in .left
- {
- left: 24px;
- }
- .brdr_in .left, .brdr_in .right
- {
- bottom: 24px;
- top: 24px;
- width: 3px;
- }
- .brdr_in .light div, .brdr_out .light div
- {
- background-color: #434345;
- }
- .brdr_in .right
- {
- right: 24px;
- }
- .brdr_in .top
- {
- top: 24px;
- }
- .brdr_out .bottom
- {
- bottom: 15px;
- }
- .brdr_out .bottom, .brdr_out .top
- {
- height: 5px;
- left: 15px;
- right: 15px;
- }
- .brdr_out .left
- {
- left: 15px;
- }
- .brdr_out .left, .brdr_out .right
- {
- bottom: 15px;
- top: 15px;
- width: 5px;
- }
- .brdr_out .right
- {
- right: 15px;
- }
- .brdr_out .top
- {
- top: 15px;
- }
- function borders() {
- var viewportHeight = $(window).height();
- var scrollY = window.scrollY;
- var distance = viewportHeight - scrollY;
- //Once we start scrolling, the top border of the next slide needs to be hidden so it doesn't appear over content
- if (scrollY >= 0) {
- $('.light .top').css('display', 'none');
- }
- if (scrollY < 27) {
- $('.brdr_in .light .bottom').css('display', 'none');
- }
- else {
- $('.brdr_in .light .bottom').css('display', 'block');
- }
- if (scrollY < 20) {
- $('.brdr_out .light .bottom').css('display', 'none');
- }
- else {
- $('.brdr_out .light .bottom').css('display', 'block');
- }
- var outerTop = distance;
- var innerTop = distance;
- //We've scrolled enough so that the top of the bottom slide reaches the top of the viewport, need to add top border back in
- if (outerTop < 15) {
- $('.brdr_out .light .top').css('display', 'block');
- outerTop = 15;
- }
- if (innerTop < 24) {
- $('.brdr_in .light .top').css('display', 'block');
- innerTop = 24;
- }
- $('.brdr_out .light .left, .brdr_out .light .right').css('top', outerTop);
- $('.brdr_in .light .left, .brdr_in .light .right').css('top', innerTop);
- //Add the background image to top/bottom to hide the text as it scrolls under/above it
- if ($('#light .brdr_out').css('border-top-width') == '0px') {
- $('#top').css('display', 'block');
- }
- else {
- $('#top').css('display', 'none');
- }
- if (scrollY > 24) {
- $('#bottom').css('display', 'block');
- }
- else {
- $('#bottom').css('display', 'none');
- }
- }
- $(window).load(function () {
- borders();
- });
- $(window).scroll(function () {
- borders();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement