mathblogging / mathblogging.org

The new home for mathblogging.org
http://mathblogging.org
0 stars 1 forks source link

[secondary-sidebar] highlight active category #15

Open pkra opened 8 years ago

pkra commented 8 years ago

As per F2F

pkra commented 8 years ago

I'm tending towards client-side JS. From this SO answer a gloriously simple query.

document.querySelectorAll('a[href="'+document.URL.substring(27)+'"]')[0].className = "current";

However, for / the logo gets in the way.

var url = document.URL.substring(27);
if (url === '/'){
  document.querySelectorAll('a[href="'+url+'"]')[1].className = "current";
}
else {
  document.querySelectorAll('a[href="'+url+'"]')[0].className = "current";
}

Plus a style for .current. What do you think?

pkra commented 8 years ago

Gah! Running into specificity issues; need to learn CSS ;-)

pkra commented 8 years ago

Check out https://github.com/mathblogging/mathblogging.org/tree/issue15 for the horror.