Using fullPage.js to make a vertical split-screen parallax

fullPage.js, as its author states, is a jQuery plugin which allows you to “create full screen pages fast and simple”.

How about using it to make a split-screen parallax fast and simple ?

First the required HTML structure:

<div id="splitscreen">
<div class="section">
<div class="column column-left">Left Side</div>
<div class="column column-right">Right Side</div>
</div>
</div>

Then init the fullPage.js, and customize the settings to your taste.

$(document).ready(function() {
$('#splitscreen').fullpage({
navigation: false,
scrollingSpeed: 1000,
});
});

Now the CSS for the split-screen:

#splitscreen > .section .column-left {
float: left;
width: 50%;
color: #000;
background: #fff;
}

#splitscreen > .section .column-right {
float: right;
width: 50%;
color: #fff;
background: #000;
}

#splitscreen > .section .column-left {
transition: all 1s ease 0s;
transform: translateY(100%);
backface-visibility: hidden;
}

#splitscreen > .section .column-right {
transition: all 1s ease 0s;
transform: translateY(-100%);
backface-visibility: hidden;
}

#splitscreen > .section.active {
z-index: 1;
}

#splitscreen > .section.active .column-left {
transform: translateY(0);
}

#splitscreen > .section.active .column-right {
transform: translateY(0);
}

#splitscreen > .section.active ~ .section .column-left {
transform: translateY(-100%);
}

#splitscreen > .section.active ~ .section .column-right {
transform: translateY(100%);
}

/* prevent fullpage from translating the page */
#splitscreen {
transform: translate3d(0px, 0px, 0px) !important;
}

#splitscreen > .section {
position: absolute;
top: 0;
left: 0;
}

Split screen parallax demo.

Comments

  1. written by: 01 on April 14, 2019 at 8:22 pm - Reply

    Hi!
    And how it could be reversed to one page once opened from the mobile device?

    • written by: Mihai on April 21, 2019 at 11:12 pm - Reply

      Hi,
      You could add a media query to reset the widths of the columns.
      Something like:

      @media screen and (max-width: 740px) {
      	.section .column-left,
      	.section .column-right {
      		width: 100%;
      	}
      }
      

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 1 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.