Skip to content

Commit f60e043

Browse files
author
Kayla Wilkins
committed
making smooth behavior work as expected
1 parent 7aadd53 commit f60e043

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/5_templates/api.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ import Caret from "../../images/svgs/caret.svg";
2121
import Copy from "../../images/svgs/copy.svg";
2222

2323
const scrollToTop = () => {
24-
window.setTimeout(() => window.scrollTo(0, 0, "smooth"));
24+
window.scrollTo({
25+
top: 0,
26+
left: 0,
27+
behavior: "smooth"
28+
});
2529
};
2630

2731
const apiPage = ({ data }) => {

src/pages/api/v4.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import Sidebar from "../../components/2_molecules/sidemenu";
1111
import Caret from "../../images/svgs/caret.svg";
1212

1313
const scrollToTop = () => {
14-
window.setTimeout(() => window.scrollTo(0, 0, "smooth"));
14+
window.scrollTo({
15+
top: 0,
16+
left: 0,
17+
behavior: "smooth"
18+
});
1519
};
1620

1721
const HeadingRenderer = props => {

0 commit comments

Comments
 (0)