Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 12 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | function scrollToNavItem() { |
||
2 | var path = window.location.href.split('/').pop().replace(/\.html/, ''); |
||
3 | document.querySelectorAll('nav a').forEach(function(link) { |
||
4 | var href = link.attributes.href.value.replace(/\.html/, ''); |
||
5 | if (path === href) { |
||
6 | link.scrollIntoView({block: 'center'}); |
||
7 | return; |
||
8 | } |
||
9 | }) |
||
10 | } |
||
11 | |||
12 | scrollToNavItem(); |
||
13 |