Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scrollTo(param) {
let offset;
if (param === "home") {
offset = 0;
} else if (param === "projects") {
offset = this.$h("home");
} else if (param === "github") {
offset = this.$h("projects") + this.$h("home");
} else if (param === "articles") {
offset = this.$h("github") + this.$h("projects") + this.$h("home");
} else if (param === "experience") {
offset = this.$h("articles") + this.$h("github") + this.$h("projects") + this.$h("home");
} else if (param === "contact") {
offset = this.$h("experience") + this.$h("articles") + this.$h("github") + this.$h("projects") + this.$h("home");
}
animateScroll.scrollTo(offset);
}
export function onAnchorClick(e) {
const el = e.target
if (el.getAttribute('ref') === internalAnchor) {
e.preventDefault()
const target = el.querySelector(`${el.getAttribute('href')}-`)
if (target) {
animateScroll.scrollTo(target.offsetTop)
}
}
}
scrollToContent = () => {
animateScroll.scrollTo(window.innerHeight * 0.8)
}
render = () => {
handleClick = (id) => {
queryUtils.pushQueryParams(this.props.location, this.props.history, {
section: id,
});
scroll.scrollTo(this.graphRef.current.offsetTop);
};
render() {
<li> <a> animateScroll.scrollTo(100)}>Scroll To 100!</a></li>
<li> <a> animateScroll.scrollToBottom()}>Scroll To Bottom</a></li>
export const scrollFunction = (
target: EventTarget,
scrollPosition: number | (currentTarget: Element) => number,
scrollAnimationConfig: Object,
) => void (
target instanceof Element
&& animateScroll.scrollTo(
typeof scrollPosition === 'function'
? scrollPosition(target)
: scrollPosition,
scrollAnimationConfig,
)
);
public scroll(index: number): void {
const element = document.querySelectorAll("article")[index] as HTMLElement;
const scrollTop = element.offsetTop - 60;
scroller.scrollTo(scrollTop);
this.setState({
activeDot: index,
});
}