Skip to content

Commit e78e94e

Browse files
fix(util): added offset to the smooth-scroll util
1 parent 2ed9925 commit e78e94e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/utilities/src/utilities/smoothScroll/smoothScroll.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ const smoothScroll = (e, selector) => {
3131
} else {
3232
return null;
3333
}
34-
document.querySelector(getSelector).scrollIntoView({
34+
35+
window.scroll({
36+
top:
37+
document.querySelector(getSelector).getBoundingClientRect().top -
38+
50 +
39+
window.scrollY,
3540
behavior: 'smooth',
36-
block: 'start',
3741
});
42+
console.log('smooth');
3843
};
3944

4045
export default smoothScroll;

0 commit comments

Comments
 (0)