Webflow sync, pageviews & more.
NEW

Is there a more optimal way to create a portfolio section with a sticky image container that changes as you scroll, similar to the design on Deveb's website, that works across different web browsers, especially Safari, using Webflow or any other JavaScript tools?

TL;DR
  • Use Webflow’s position: sticky with a block-level parent to avoid Safari layout issues.
  • Create a two-column layout with full-screen project sections and a sticky image container.
  • Use JavaScript (IntersectionObserver) or GSAP’s ScrollTrigger to update the image based on the active scroll section.
  • Preload or lazy-load images and animate transitions (opacity/scale) for smooth visual updates.

Creating a portfolio section with a sticky image container that updates with scroll can be built efficiently in Webflow using native tools plus lightweight JavaScript for cross-browser stability, especially targeting Safari's quirks.

1. Use Webflow’s Sticky Position with Fallback Considerations

  • Set the image container to position: sticky using Webflow’s visual styling (under Style → Position).
  • Stick it to the top by setting Top: 0. This allows the image container to stay in view while the content scrolls.
  • Safari Note: Safari has inconsistent support for position: sticky on flex or grid children. To avoid this:
  • Ensure the sticky container’s direct parent is not using display: flex or grid.
  • Use a div with display: block or wrap the sticky container in a block-level wrapper.

2. Structure the Right Layout

  • Create a 2-column layout: on the left, a vertically scrolling list of projects; on the right, the sticky image container.
  • Each project section (in the left column) should be set to 100vh height, so it takes up full screen.
  • Inside each section, add a data-attribute or a custom class to reference the associated image.

3. Use JavaScript for Dynamic Image Switching

  • Use lightweight JavaScript (like IntersectionObserver) to detect which project section is currently in view.

  • Update the image src, background-image, or content in the sticky container based on the active section.

    Example logic (pseudo-code):

  • For each project section, observe when it enters the viewport.

  • When a section is active, swap the image in the sticky container accordingly.

  • Works across browsers and helps avoid Safari-exclusive layout bugs.

4. Use GSAP + ScrollTrigger for Smooth Transitions (Optional)

  • GSAP's ScrollTrigger plugin is highly reliable and works across all major browsers, including Safari.

  • It enables smoother transitions, fade-ins, and parallax scroll effects.

  • Use ScrollTrigger to:

  • Pin the image container (if sticky fails).

  • Animate image changes (opacity switch, scale, etc.) as the user scrolls into each section.

    This can fully replace Webflow’s native scroll interaction system, which has limitations and cross-browser inconsistencies.

5. Optimize Image Loading and Transitions

  • Use preload or lazy-loading appropriately to avoid flashes as images change (loading="lazy" or preloading high-priority assets).
  • Animate opacity or scale rather than directly replacing images unless necessary to ensure visual smoothness.

Summary

To build a sticky scroll-triggered image container like Deveb’s, use Webflow’s position: sticky, fix layout issues for Safari by avoiding flex/grid parents, and dynamically manage content using IntersectionObserver or GSAP + ScrollTrigger for cleaner image transitions across all modern browsers.

Rate this answer

Other Webflow Questions