Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
slideToAnnotation(pos) {
// remove active class
const els = document.querySelectorAll('.pl-js-annotations li');
for (let i = 0; i < els.length; ++i) {
els[i].classList.remove('pl-is-active');
}
const patternInfoElem = document.querySelector('.pl-js-pattern-info');
// const scroll = new Scroll(patternInfoElem);
// add active class to called element and scroll to it
for (let i = 0; i < els.length; ++i) {
if (i + 1 === pos) {
els[i].classList.add('pl-is-active');
scrollTo(patternInfoElem, document.body, {
top: els[i].offsetTop - 14,
behavior: 'smooth',
}).then(function() {
// console.log('finished scrolling');
});
}
}
},