mirror of https://github.com/explosion/spaCy.git
Only scroll sidebar item into view if needed [ci skip]
This commit is contained in:
parent
65713a6593
commit
53a2bc8c8d
|
@ -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": {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue