-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.js
More file actions
29 lines (24 loc) · 681 Bytes
/
docs.js
File metadata and controls
29 lines (24 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(function () {
document.addEventListener('DOMContentLoaded', function () {
var url = location.href;
var index = url.lastIndexOf('/');
if (index === -1)
return;
var name = url.substring(index + 1);
if (!name)
return;
if (!name.endsWith(".html") || name === 'index.html')
return;
var current = document.querySelector('.tsd-navigation a[href="' + name + '"]')
if (!current)
return;
current.classList.add('current');
var menu = document.querySelector("div.site-menu");
if (!menu)
return;
menu.scrollTo({
top: current.offsetTop - current.clientHeight,
behavior: 'smooth',
})
})
})()