Commit e4914104 authored by Pietro Albini's avatar Pietro Albini

navbar: fix null check in the javascript

parent 13e7ecff
...@@ -18,7 +18,7 @@ function ubuntuit_navbar_center_active() { ...@@ -18,7 +18,7 @@ function ubuntuit_navbar_center_active() {
var navs = document.querySelectorAll("nav"); var navs = document.querySelectorAll("nav");
for (var i = 0; i < navs.length; i++) { for (var i = 0; i < navs.length; i++) {
var active = navs[i].querySelector(".active"); var active = navs[i].querySelector(".active");
if (active !== undefined) { if (active !== null) {
var offset = active.getBoundingClientRect().left; var offset = active.getBoundingClientRect().left;
navs[i].scrollBy(offset - window.innerWidth / 2 + active.offsetWidth / 2, 0); navs[i].scrollBy(offset - window.innerWidth / 2 + active.offsetWidth / 2, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment