Smooth scroll to a position?

In my card JS <script>, I’m using the following to scroll centering on an element:

  function scrollTo(elm) {
    window.scroll({
    top: elm.getBoundingClientRect().top + window.scrollY - window.innerHeight/2,
    behavior: 'smooth'
    });
  }

my only gripe is that the smooth scrolling behaviour is ignored. any way to resolve this?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.