Scroll · 02 of 34

Slide Up

Content rises into place while fading in, the most common entrance for cards and sections. A translateY offset plus opacity, both transitioned on an ease-out curve.

HTML · CSS · JavaScript · No dependencies · MIT

HTML

<section class="slide-up-section">
  <h2>Slide Up</h2>
</section>

CSS

.slide-up-section {
  min-height: 35vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-up-section h2 {
  font-size: 2.5rem;
  color: #f0f0f5;
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-up-section.in-view h2 {
  opacity: 1;
  transform: translateY(0);
}

JavaScript

var section = document.querySelector('.slide-up-section');

new IntersectionObserver(function (entries) {
  entries.forEach(function (entry) {
    entry.target.classList.toggle('in-view', entry.isIntersecting);
  });
}, { threshold: 0.25 }).observe(section);