Smooth scroll component

Scrolls smoothly to and from in-page anchor targets - i.e. links that point to an ID on the page like #id. Scrolling takes viewport displacement into account; for example, from the Drupal toolbar. Uses the GreenSock ScrollToPlugin internally for animation and a technique from the smoothscroll-anchor-polyfill to ensure back/forward navigation scrolls smoothly.

View demo
id: smooth_scroll
title: 'Smooth scroll'
description: 'Scrolls smoothly to and from in-page anchor targets - i.e. links that point to an ID on the page like #id. Scrolling takes viewport displacement into account; for example, from the Drupal toolbar. Uses the GreenSock ScrollToPlugin internally for animation and a technique from the smoothscroll-anchor-polyfill to ensure back/forward navigation scrolls smoothly.'
class: Drupal\ambientimpact_ux\Plugin\AmbientImpact\Component\SmoothScroll
provider: ambientimpact_ux
{  }
component.smooth_scroll:
  js:
    components/smooth_scroll/smooth_scroll.js:
      attributes:
        defer: true
  dependencies:
    - ambientimpact_core/component.media_query
    - ambientimpact_ux/gsap.tweenlite
    - ambientimpact_ux/gsap.plugin.scrollto
    - ambientimpact_ux/component.displace
    - ambientimpact_core/framework
component.smooth_scroll.demo:
  js:
    components/smooth_scroll/smooth_scroll.demo.js:
      attributes:
        defer: true
  dependencies:
    - ambientimpact_ux/component.smooth_scroll
    - ambientimpact_web_components/component.component_demo
    - ambientimpact_core/framework