Smoothscroll Anchor Polyfill Versions Save

⚓ Apply smooth scroll to anchor links, polyfill scroll-behavior

v1.0.0

5 years ago

Changelog

[1.0.0] - 2018-12-08

Added

  • The methods 'destroy' and 'polyfill' are now available as exports (CommonJS) or exposed on window.SmoothscrollAnchorPolyfill. The polyfill still runs automatically on load so embedding it is enough, but now you can destroy it if you want (EventListeners are removed) and start it again, later.
  • In addition to window.__forceSmoothscrollAnchorPolyfill__, you can now pass { force: true } when invoking polyfill() to force-enable the package even in browsers with native support

Changed

  • Updated the documentation website to reflect the new API
  • Moved the documentation to a separate docs/ folder to clean up the repo
  • Small fixes for formatting and typos in the README

v1.0.0-beta

5 years ago

Changelog

[1.0.0-beta] - 2018-12-05

Changed

  • The README.md file has been updated to match the API of v1.0.0
  • Fixed 'window is not defined' error in Node environments, important for usage with SSR
  • BREAKING: Polyfill now only handles smooth scroll if scroll-behavior is set to 'smooth' via <html style="">, documentElement.style.scrollBehavior or a custom font-family (more information will be added to the documentation)

Added

  • Tests for smooth scrolling when clicking anchors have been implemented

v0.9.4

5 years ago

Changelog

[0.9.4] - 2018-11-11

Fixed

  • After a click, the DOM is now searched upwards for a matching anchor link instead of just checking the event target alone. Fixes issue with nested elements inside anchor links

v0.12.0

5 years ago

Changelog

[0.12.0] - 2018-11-15

Added

  • The special fragment #top is now supported for scrolling to the top, but only if no element with id top is found
  • After navigating to an anchor, the respective hash is now appended to the URL using history.pushState() to match default browser behavior.
  • When a hashchange event occurs, the polyfill tries to cancel the instant jumping scroll to the new hash, handling it with the smooth scroll instead.
  • When navigating to an anchor, the anchor is now focused.
  • In browsers supporting the optional preventScroll argument, the anchor is focused immediately and the focus scroll is prevented by passing this argument.
  • If the browser doesn't support preventScroll (e.g. Internet Explorer), the focus is scheduled to happen 450ms after the smooth scroll started so it does not interfere with the smooth scrolling (which caused flickering).

Changed

  • The flag to enforce the polyfill (even if the browser has native support) is now called window.__forceSmoothscrollAnchorPolyfill__. The docs have been updated to reflect this.

Fixed

  • The polyfill now properly handles Shift/Meta keys and allows for opening links in new windows by shift-clicking instead of preventing it with event.preventDefault()
  • The docs website now works in Internet Explorer 9, polyfills for Element.classList, requestAnimationFrame + an alternative for flexbox layouts have been added