Use vanilla JS for scroll-to-top.js

Created on 12 January 2023, almost 2 years ago
Updated 10 August 2023, over 1 year ago

Problem/Motivation

In https://www.drupal.org/project/bs_lib/issues/3325962 🐛 ScrollTo behavior does not take into account the Fixed elements setting if not on the frontpage Fixed we removed jQuery from anchor-scroll.js. In scroll-to-top.js we are using simple jQuery methods which we ca easily replace with vanilla JS.

Even the call

$root.animate({ scrollTop: 0 }, $this.data('duration'), $this.data('easing'));

Can now be replaced with vanilla JS scroll call because all browsers support now behavior option so we can use smooth parameter for this:
- https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll
- https://caniuse.com/css-scroll-behavior

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇷🇸Serbia pivica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024