Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 27x 874x 8x 8x 8x 8x 8x 7x 8x 874x | import { useCallback } from "react";
export const useHandleScroll = (noBorder = false) => {
const onScroll: React.UIEventHandler<HTMLDivElement> = useCallback((e) => {
const target = e.currentTarget;
const div = document.getElementById("slide-me");
const bar = document.getElementById("slide-me2");
const styleName = noBorder ? "noborder-overlay-enabled" : "overlay-enabled";
if (div) {
div.style.transform = `translateY(${-target.scrollTop}px)`;
}
Iif (bar) {
if (target.scrollTop > 1) {
bar.classList.add(styleName);
} else {
bar.classList.remove(styleName);
}
}
}, []);
return { onScroll };
};
|