JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/plugins/animation.gsap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/plugins/debug.addIndicators.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,500,700,900" rel="stylesheet" />
<div class="test-2019">
<section class="first">
<h1 class="hi-ibudok"><span class="hi">First boi</span></h1>
</section>
<section class="second">
<h1 class="birthday-messsage">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Aspernatur voluptate soluta laboriosam doloremque error, tempore eum non doloribus rem corporis vero, harum quos at laborum hic. Quo natus quisquam perferendis?
</h1>
</section>
<section class="third">
<h1 class="last-regards">Third boi</h1>
</section>
</div>
CSS
* {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
body {
margin: 0;
padding: 0;
}
.test-2019 h1,
.test-2019 h2,
.test-2019 h3,
.test-2019 h4,
.test-2019 h5,
.test-2019 h6,
.test-2019 p {
margin-top: 0;
font-family: 'Montserrat';
font-weight: 900;
}
.test-2019 section {
height: 100vh !important;
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
}
.test-2019 section h1 {
width: 70%;
}
.test-2019 .first {
background-color: blue;
text-align: center;
}
.test-2019 .second {
background-color: aqua;
}
.test-2019 .third {
background-color: brown;
}
.test-2019 .fourth {
background-color: chartreuse;
}
JavaScript
jQuery(document).ready(function($) {
var initialAnimation = new TimelineMax();
initialAnimation.from($('.hi'), 0.5, {
autoAlpha: 0
});
initialAnimation.from($('.ibudok'), 1, {
autoAlpha: 0
});
var controller = new ScrollMagic.Controller();
var firstSection = new TimelineMax().add([
TweenMax.to('.first', 1, {
autoAlpha: 0
})
]);
var firstSectionScroll = new ScrollMagic.Scene({
triggerElement: '.first',
triggerHook: 0,
duration: '100%'
})
.setTween(firstSection)
.setPin('.first', {
pushFollowers: false
})
.addTo(controller)
.addIndicators();
// second top section
var secondTopSection = new TimelineMax().add([
TweenMax.from('.second', 1, {
opacity: 0
})
]);
var secondTopSectionScroll = new ScrollMagic.Scene({
triggerElement: '.second',
triggerHook: 0,
duration: '100%'
})
.setTween(secondTopSection)
.setPin('.second', {
pushFollowers: false
})
.addTo(controller)
.addIndicators();
// third top section
var thirdTopSection = new TimelineMax().add([
TweenMax.from('.third', 1, {
opacity: 0
})
]);
var thirdTopSectionScroll = new ScrollMagic.Scene({
triggerElement: '.third',
triggerHook: 0,
duration: '100%'
})
.setTween(thirdTopSection)
.setPin('.third')
.addTo(controller)
.addIndicators();
});