Converted the css to sass
This commit is contained in:
@@ -15,13 +15,13 @@ export const Anchoring = (props: AnchoringProps) => {
|
||||
|
||||
const handleScrollOpacity = () => {
|
||||
const scrollTop = window.scrollY || window.pageYOffset;
|
||||
const elementHeight = anchoringRef.current.clientHeight;
|
||||
const elementHeight = anchoringRef.current?.clientHeight ? anchoringRef.current.clientHeight : 1;
|
||||
const newOpacity = (elementHeight - scrollTop) / elementHeight;
|
||||
setOpacity(newOpacity);
|
||||
};
|
||||
|
||||
const handleScrollClick = () => {
|
||||
anchoringRef.current.scrollIntoView({
|
||||
anchoringRef?.current?.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user