All Projects → mauricevancooten → React Anchor Link Smooth Scroll

mauricevancooten / React Anchor Link Smooth Scroll

React component for anchor links using the smooth scroll polyfill.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Anchor Link Smooth Scroll

React Terminal Component
Terminal emulator component for React. Emulate a terminal/console with autocomplete, commands, a file-system and themes.
Stars: ✭ 169 (-9.14%)
Mutual labels:  react-component
Dialog Polyfill
Polyfill for the HTML dialog element
Stars: ✭ 2,152 (+1056.99%)
Mutual labels:  polyfill
React Rater
⭐️ Interative & customizable star rater
Stars: ✭ 180 (-3.23%)
Mutual labels:  react-component
React Tradingview Widget
React component for rendering the TradingView Advanced Real-Time Chart Widget.
Stars: ✭ 170 (-8.6%)
Mutual labels:  react-component
Animate Css Styled Components
simple port of animate css for styled-components
Stars: ✭ 173 (-6.99%)
Mutual labels:  react-component
React Awesome Slider
React content transition slider. Awesome Slider is a 60fps, light weight, performant component that renders an animated set of production ready UI general purpose sliders with fullpage transition support for NextJS and GatsbyJS. 🖥️ 📱
Stars: ✭ 2,343 (+1159.68%)
Mutual labels:  react-component
Miniprogram
猫眼电影/Taro/微信小程序/React
Stars: ✭ 163 (-12.37%)
Mutual labels:  react-component
Jquery Contextmenu
jQuery contextMenu plugin & polyfill
Stars: ✭ 2,148 (+1054.84%)
Mutual labels:  polyfill
React Component Echarts
React component echarts. 组件式百度图表。
Stars: ✭ 175 (-5.91%)
Mutual labels:  react-component
React Sticky El
Stars: ✭ 179 (-3.76%)
Mutual labels:  react-component
Webp Hero
browser polyfill for the webp image format
Stars: ✭ 171 (-8.06%)
Mutual labels:  polyfill
Object Fit Images
🗻 Polyfill object-fit/object-position on <img>: IE9, IE10, IE11, Edge, Safari, ...
Stars: ✭ 2,050 (+1002.15%)
Mutual labels:  polyfill
React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (-5.38%)
Mutual labels:  react-component
Iphone Inline Video
📱 Make videos playable inline on the iPhone (prevents automatic fullscreen)
Stars: ✭ 2,020 (+986.02%)
Mutual labels:  polyfill
React Mobile Picker
An iOS like select box component for React
Stars: ✭ 180 (-3.23%)
Mutual labels:  react-component
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+961.83%)
Mutual labels:  react-component
Video React
A web video player built for the HTML5 world using React library.
Stars: ✭ 2,227 (+1097.31%)
Mutual labels:  react-component
Rangeslider.js
🎚 HTML5 input range slider element polyfill
Stars: ✭ 2,153 (+1057.53%)
Mutual labels:  polyfill
React Native Card Flip
Card flip animation for React Native
Stars: ✭ 183 (-1.61%)
Mutual labels:  react-component
React Credit Cards
Beautiful credit cards for your payment forms
Stars: ✭ 2,239 (+1103.76%)
Mutual labels:  react-component

React Anchor Link Smooth Scroll

React component for anchor links using the smoothscroll polyfill.

Instructions

  1. Install dependency: npm install react-anchor-link-smooth-scroll

  2. Add script

    import React from 'react'
    import ReactDOM from 'react-dom'
    import AnchorLink from 'react-anchor-link-smooth-scroll'
    
    const SmoothScroll = () => (
      <div>
        <AnchorLink href='#things'>Things</AnchorLink>
        <AnchorLink href='#stuff'>Stuff</AnchorLink>
    
        <section id='things'>
        <h2>Things</h2>
        </section>
        <section id='stuff'>
          <h2>Stuff</h2>
        </section>
      </div>
    )
    
    ReactDOM.render(
      <SmoothScroll />,
      document.getElementById('content')
    )
    
  3. Options; offset the amount of pixels from the top, for if you have a sticky navigation.

    • Regular offset

       <AnchorLink offset='100' href='#things'>Things</AnchorLink>
      
    • For responsive offset you can provide a function returning the needed integer to scroll from

       <AnchorLink offset={() => 100} href='#things'>Things</AnchorLink>
      

Changelog

v.1.0.11 (July 24th 2018), @ericmasiello Fixed; offset prop from being spread, to avoid remaining props spread to anchor link element.

v1.0.10 (May 30th 2018), @DanMMX Created an option to receive a function for an offset calculation.

v1.0.9 (April 24th 2018), @gazpachu Fix to have hash change in address bar.

v1.0.7 (April 10th 2018), @zauni Fixed problem with nested HTML inside the anchor.

@roborourke Fixed possibility of a custom onClick handler for secondary side effects.

Licence

Licensed under the MIT Licence.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].