Scroll · 03 of 34
Slide From Right
Enters from the right edge and settles in, a good fit for alternating two-column layouts. translateX with an ease-out so it decelerates into position.
<section class="slide-left-section">
<h2>Slide From Right</h2>
</section>
.slide-left-section {
min-height: 35vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden; /* keep the off-screen start from widening the page */
}
.slide-left-section h2 {
font-size: 2.5rem;
color: #f0f0f5;
opacity: 0;
transform: translateX(80px);
transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.slide-left-section.in-view h2 {
opacity: 1;
transform: translateX(0);
}
var section = document.querySelector('.slide-left-section');
new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
entry.target.classList.toggle('in-view', entry.isIntersecting);
});
}, { threshold: 0.25 }).observe(section);