79386402

Date: 2025-01-25 08:28:59
Score: 1
Natty:
Report link

You can actually use clip-path to cut some space from the scrollable area while scrolling.

const headerArea = document.getElementById('header');
const scrollableArea = document.getElementById('scrollable');

const headerAreaHeight = headerArea.offsetHeight;

windows.addEventListener('scroll', () => {

    const scrollableAreaTop = scrollableArea.getBoundingClientRect().top;
    scrollableArea.style.clipPath = `inset(${headerAreaHeight - scrollableAreaTop}px 0 0 0)`;

});

p.s. Inspired by that answer https://stackoverflow.com/a/62162491/1078641

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: electroid