How to use react-scrollchor - 2 common examples

To help you get started, we’ve selected a few react-scrollchor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opencollective / opencollective-frontend / src / components / MenuBar.js View on Github external
adjustScrollPosition = () => {
    if (window.location.hash) {
      const animate = {
        duration: 400,
        offset: -this.height,
        easing: (x, t, b, c, d) => -c * (t /= d) * (t - 2) + b,
      };
      animateScroll(window.location.hash.substr(1), animate)
        .then(id => this.setState({ selectedAnchor: id }))
        .catch(() => {});
    }
  };
github opencollective / opencollective-frontend / components / MenuBar.js View on Github external
adjustScrollPosition = () => {
    if (window.location.hash) {
      const animate = {
        duration: 400,
        offset: -this.height,
        easing: (x, t, b, c, d) => -c * (t /= d) * (t - 2) + b,
      };
      animateScroll(window.location.hash.substr(1), animate)
        .then(id => this.setState({ selectedAnchor: id }))
        .catch(() => {});
    }
  };

react-scrollchor

A React component for scrolling to #hash links with smooth animations

ISC
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Popular react-scrollchor functions