How to use scroll-into-view - 10 common examples

To help you get started, we’ve selected a few scroll-into-view 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 imyelo / pokequest-wiki / src / plugins / anchor / mixin.js View on Github external
scrollToAnchor (anchor) {
      if (!this.$route) {
        return
      }
      anchor = anchor || this.$route.query.anchor
      if (!anchor) {
        return
      }
      let node = document.querySelector(`[data-anchor=${anchor}]`)
      if (!node) {
        return
      }
      scrollIntoView(node, {
        time: 400,
        align: {
          top: 0,
        },
      })
    },
  },
github ouxu / NEUQ-OJ / app / src / utils / windowScroll.js View on Github external
const scrollToAnchor = (anchorName, config={}) => {
  if (anchorName) {

    let anchorElement = document.getElementById(anchorName)
    if (anchorElement) { scrollToView(anchorElement, config) }
  }
}
github skmail / responsive-viewer / src / saga / index.js View on Github external
eventChannel(emitter => {
      scrollIntoView(
        element,
        {
          align: {
            top: 0.1,
            left: 0,
            topOffset: 25,
            leftOffset: 0,
          },
        },
        () => {
          emitter(END)
        }
      )

      return () => {}
    })
github seulibrary / Sorin / apps / frontend / assets / js / containers / Collections / index.js View on Github external
handleScrollToElement = () => {
        ScrollIntoView(ReactDOM.findDOMNode(this.createCollectionRef.current), {align: {top: 1}})
    }
github groupon / DotCi / src / main / jsx / components / job / build / Console.jsx View on Github external
_scrollToBottom(e){
    if(e){
      e.preventDefault();
    }
    this._setInitialTop();
    scrollIntoView( this.refs.bottom);
    this._onLogScroll();
  },
  _onLineSelect(event){
github fakob / MoviePrint_v004 / app / containers / VisibleThumbGrid.js View on Github external
scrollThumbIntoView = () => {
    if (this.scrollIntoViewElement && this.scrollIntoViewElement.current !== null) {
      scrollIntoView(this.scrollIntoViewElement.current, {
        time: 300,
        align: {
          left: 0.5,
        }
      });
    }
  };
github orbiting / styleguide / src / components / TeaserCarousel / Row.js View on Github external
onClick={() => {
          const scroller = overflow.current
          const clientWidth = scroller.clientWidth
          const target = Array.from(scroller.children).find(element => {
            const { left } = element.getBoundingClientRect()
            return left + clientWidth >= 0
          })
          scrollIntoView(target, {
            time: 400,
            align: {
              left: 0,
              leftOffset: TILE_MARGIN_RIGHT,
              ...getTop()
            }
          })
        }}
      >
github orbiting / styleguide / src / components / Discussion / Composer / CommentComposer.js View on Github external
React.useEffect(() => {
    if (textarea) {
      textarea.focus()

      if (window.innerWidth < mBreakPoint) {
        scrollIntoView(root.current, { align: { top: 0, topOffset: 60 } })
      }
    }
  }, [textarea])
github envkey / envkey-app / envkey-react / src / components / env_manager / env_grid_content.js View on Github external
componentDidUpdate(prevProps, prevState) {
    if(this.state.highlightRows){
      const keysAdded = R.difference(
                          R.keys(this.state.highlightRows),
                          R.keys(prevState.highlightRows)
                        )

      if (keysAdded.length){
        const key = R.last(keysAdded),
              row = ReactDOM.findDOMNode(this.refs[`row-${key}`])

        scrollIntoView(row, {time: 150, align: {top: 0, topOffset: 210}})
      }
    }
  }
github OpenConext / OpenConext-manage / manage-gui / src / components / Autocomplete.jsx View on Github external
componentDidUpdate(prevProps) {
        if (this.selectedRow && prevProps.selected !== this.props.selectedRow) {
            scrollIntoView(this.selectedRow);
        }
    }

scroll-into-view

scrolls an elements into view, recursively aligning parents.

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular scroll-into-view functions