Why doesn't the smooth scroll polyfill work in IE11?
-
registered in html inline
& lt; html lang = "en" style = "scroll-behavior: smooth;" & gt;
installed smoothscroll-polyfill and smoothscroll-anchor-polyfill via npm
Imported polyfills and called smoothscrollPolyfill.polyfill:
import smoothscrollPolyfill from 'smoothscroll-polyfill'; import smoothscrollAnchorPolyfill from 'smoothscroll-anchor-polyfill'; smoothscrollPolyfill.polyfill();
As a result, smooth scrolling worked in safari, but does not work in ie11. Any help would be welcome.
The layout can be viewed on github pages: https://lir-kulikov.github.io/Bino/ (used smooth scrolling for anchor links in navigation)JavaScript Anonymous, Jun 27, 2019 -
I find it easier to follow the anchor links via the jQuery animate property.
Various easing functions can be included as a script https: //cdnjs.cloudflare.com/ajax/libs/jquery-easi ...
And when trying to navigate to an element, just animate the scrollTop
function scrollToElement (id){
$('html, body').animate({scrollTop: $('#' + id).offset().top}, /*время анимации в миллисекундах*/, /*функция плавности в кавычках, например "easeInOutExpo"*/)
}Graham Williams
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!