function inViewport(elem, callback, options = {}) {
return new IntersectionObserver(entries => {
entries.forEach(entry => callback(entry));
}, options).observe(document.querySelector(elem));
}
inViewport('.target', element => {
//element.isIntersecting (bool) true/false
}, {
root: document.querySelector('.scroll')
})