Fixed it with:
element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' })
see: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
More Related Contents:
- JS hide function error
- How to read with JavaScript [closed]
- How to implement something like this GIF that using mouse drag and select items
- Javascript counting all the characters from a HTML document
- Set cookie and get cookie with JavaScript [duplicate]
- Load and execution sequence of a web page?
- Check if an element contains a class in JavaScript?
- CSS transition doesn’t start/callback isn’t called
- JSFiddle code not working in my own page
- All About…. Z-Index?
- How to disable scroll without hiding it?
- Get the device width in javascript
- Set Webkit Keyframes Values Using Javascript Variable
- Why my show hide button needs double-click on first time
- Make scrollbar visible in mobile browsers
- Infinity Loop Slider Concepts
- Where should I put the CSS and Javascript code in an HTML webpage?
- jQuery Validation using the class instead of the name value
- Change CSS of class in Javascript?
- Center flex item in container, when surrounded by other flex items
- Access CSS file contents via JavaScript
- How to create checkbox inside dropdown?
- CSS Transition doesn’t work with top, bottom, left, right
- Add CSS rule via jQuery for future created elements
- Javascript-Setting background image of a DIV via a function and function parameter
- Preventing Child from firing parent’s click event
- How to keep elements non-refreshed
- How do you swap DIVs on mouseover (jQuery)?
- How to get a leaflet map canvas to have a 100% height?
- Can I save input from form to .txt in HTML, using JAVASCRIPT/jQuery, and then use it?