How to use animated-scroll-to - 8 common examples

To help you get started, we’ve selected a few animated-scroll-to 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 MyBitFoundation / MyBit-Go.website / components / slider.js View on Github external
scroll(offset){
    const element = this.list;
    const width = element.offsetWidth;
    const scrollWidth = element.scrollWidth;
    const toScroll = scrollWidth - width;
    const futurePosition = this.state.currentScroll + offset;
    const offSetToMin = 0 + futurePosition;
    const offSetToMax = toScroll - futurePosition;

    // case where we are going to be resetting scroll, which does it as well if there are only 100px left or less
    if(futurePosition <= 0 || offSetToMin <= 100){
      animateScrollTo(0, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: 0, isBeginning: true})
    }
    // case where we are going to be scrolling to the end, which does it as well if there are only 100px left or less
    else if(futurePosition >= toScroll || offSetToMax <= 100){
      animateScrollTo(toScroll, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: toScroll, isEnd: true})
    }
    // case where we have not reached an endge
    else{
      animateScrollTo(futurePosition, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: futurePosition, isBeginning: false, isEnd: false})
    }
  }
github MyBitFoundation / MyBit-Go.website / components / slider.js View on Github external
const offSetToMin = 0 + futurePosition;
    const offSetToMax = toScroll - futurePosition;

    // case where we are going to be resetting scroll, which does it as well if there are only 100px left or less
    if(futurePosition <= 0 || offSetToMin <= 100){
      animateScrollTo(0, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: 0, isBeginning: true})
    }
    // case where we are going to be scrolling to the end, which does it as well if there are only 100px left or less
    else if(futurePosition >= toScroll || offSetToMax <= 100){
      animateScrollTo(toScroll, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: toScroll, isEnd: true})
    }
    // case where we have not reached an endge
    else{
      animateScrollTo(futurePosition, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: futurePosition, isBeginning: false, isEnd: false})
    }
  }
github MyBitFoundation / MyBit-Go.website / components / slider.js View on Github external
const element = this.list;
    const width = element.offsetWidth;
    const scrollWidth = element.scrollWidth;
    const toScroll = scrollWidth - width;
    const futurePosition = this.state.currentScroll + offset;
    const offSetToMin = 0 + futurePosition;
    const offSetToMax = toScroll - futurePosition;

    // case where we are going to be resetting scroll, which does it as well if there are only 100px left or less
    if(futurePosition <= 0 || offSetToMin <= 100){
      animateScrollTo(0, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: 0, isBeginning: true})
    }
    // case where we are going to be scrolling to the end, which does it as well if there are only 100px left or less
    else if(futurePosition >= toScroll || offSetToMax <= 100){
      animateScrollTo(toScroll, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: toScroll, isEnd: true})
    }
    // case where we have not reached an endge
    else{
      animateScrollTo(futurePosition, {minDuration: 500, element, horizontal: true});
      this.setState({currentScroll: futurePosition, isBeginning: false, isEnd: false})
    }
  }
github MyBitFoundation / MyBit-Go.website / pages / community.js View on Github external
scrollToEvents() {
    const el = this.el
    animateScrollTo(0, {
      minDuration: 750,
      horizontal: false,
      offset: el.offsetTop
    })
  }
github MyBitFoundation / MyBit-Go.website / pages / investor.js View on Github external
scrollToIndustries() {
    const el = this.el
    animateScrollTo(0, {
      minDuration: 750,
      horizontal: false,
      offset: el.offsetTop - 250
    })
  }
github wassgha / digital-signage / components / AutoScroll.js View on Github external
setInterval(() => {
      animateScrollTo(9999999, {
        minDuration: duration,
        element: containerNode
      })
      setTimeout(() => {
        animateScrollTo(0, {
          minDuration: duration,
          element: containerNode
        })
      }, duration)
    }, duration)
  }
github SolidZORO / leaa / packages / leaa-dashboard / src / utils / url.util.ts View on Github external
let nextUrl = prevBaseUrl;

  let paramsString = '';

  if (paramsObject) {
    paramsString = queryString.stringify(paramsObject);
  }

  nextUrl += `${paramsString ? '?' : ''}${paramsString}`;

  if (replace) {
    window.history.pushState(null, '', nextUrl);
  }

  animateScrollTo(0);

  return nextUrl;
};
github spatie / nova-tail-tool / resources / js / components / Terminal.vue View on Github external
scrollToBottom() {
            this.isScrollingToBottom = true;

            animateScrollTo(this.$refs.window.scrollHeight, {
                speed: 250,
                element: this.$refs.window,
                onComplete: () => {
                    this.isScrollingToBottom = false;
                    this.updateIsScrolledToBottom();
                },
            });
        },
    },

animated-scroll-to

Simple, plain JavaScript animated window scroll

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Popular animated-scroll-to functions