element scrollIntoView does not work in safari

Viewed 159

This function is used get element into view

if (elmement) {
      const rect = elmement.getBoundingClientRect();
      if (rect.top < 0 ) {
        elmement.scrollIntoView(true );
      } else if (rect.bottom > window.innerHeight) {
        elmement.scrollIntoView(rect.top <= 0);
        }
      }

does not work in safari 14 but works in chrome any solution ??

as per doc safari 14 supports boolean enter link description here

0 Answers
Related