From 03ed12b471c1e50ae531c46fcbf5afd06ca5432b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 5 Dec 2018 18:23:32 +0100 Subject: build --- site/assets/js/app/site.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'site/assets/js') diff --git a/site/assets/js/app/site.js b/site/assets/js/app/site.js index 04c0c495..12bee3ec 100644 --- a/site/assets/js/app/site.js +++ b/site/assets/js/app/site.js @@ -7,6 +7,8 @@ const isDesktop = !isMobile const htmlClassList = document.body.parentNode.classList htmlClassList.add(isDesktop ? 'desktop' : 'mobile') +function toArray(A) { return Array.prototype.slice.apply(A) } + var site = (function(){ var site = {} site.init = function(){ @@ -17,6 +19,11 @@ var site = (function(){ if (paras.length) { paras[0].classList.add('first_paragraph') } + toArray(document.querySelectorAll('header .links a')).forEach(tag => { + if (window.location.href.match(tag.href)) { + tag.classList.add('active') + } + }) } site.init() })() \ No newline at end of file -- cgit v1.2.3-70-g09d2