diff --git a/website/_harp.json b/website/_harp.json index 335f3a131..106f039cf 100644 --- a/website/_harp.json +++ b/website/_harp.json @@ -84,8 +84,8 @@ } ], - "V_CSS": "2.2.0", - "V_JS": "2.2.0", + "V_CSS": "2.2.1", + "V_JS": "2.2.1", "DEFAULT_SYNTAX": "python", "ANALYTICS": "UA-58931649-1", "MAILCHIMP": { diff --git a/website/assets/js/main.js b/website/assets/js/main.js index 2ae1a4691..81eca8456 100644 --- a/website/assets/js/main.js +++ b/website/assets/js/main.js @@ -61,10 +61,10 @@ import initUniverse from './universe.vue.js'; const sidebarAttr = 'data-sidebar-active'; const sections = [...document.querySelectorAll(`[${navAttr}]`)]; const currentItem = document.querySelector(`[${sidebarAttr}]`); - if (currentItem && Element.prototype.scrollIntoView) { - currentItem.scrollIntoView(); - } if (window.inView) { + if (currentItem && Element.prototype.scrollIntoView && !inView.is(currentItem)) { + currentItem.scrollIntoView(); + } if (sections.length) { // highlight first item regardless sections[0].classList.add(activeClass); } @@ -74,7 +74,7 @@ import initUniverse from './universe.vue.js'; if (el) { sections.forEach(el => el.classList.remove(activeClass)); el.classList.add(activeClass); - if (Element.prototype.scrollIntoView) { + if (Element.prototype.scrollIntoView && !inView.is(el)) { el.scrollIntoView(); } }