I am using scrollIntoView()
to go to a selected input. But I set it to top, so I would like to give with an offset to that method.
But this seems not to work I also checked the scrollTo method and did that like this:
this.keyboard.onKeyboardShow().subscribe(() => {
console.log('document.activeElement!!!!', document.activeElement)
// document.activeElement.scrollIntoView(true);
const top = document.activeElement.getBoundingClientRect().top + window.scrollY;
console.log(top);
window.scroll(0, top)
window.scrollTo({
top: top,
behavior: 'smooth'
});
// document.activeElement.scrollTo(0, 10);
window.scrollBy(-100, 0);
});
But this will not scroll to that element anymore. Could somebody help me out setting an offset to scrollIntoView()