From: Marius Gavrilescu Date: Wed, 10 Dec 2014 11:50:43 +0000 (+0200) Subject: Highlight current nav via javascript X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=4b4a81371ead43b2f9e01a924625eda1e5275199;p=gruntmaster-page.git Highlight current nav via javascript --- diff --git a/MANIFEST b/MANIFEST index 14d91b8..93228f4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -16,6 +16,7 @@ js/10-bootstrap-dropdown.js js/10-bootstrap-modal.js js/90-custom.js js/90-form.js +js/90-nav.js lib/Plack/App/Gruntmaster.pm lib/Plack/App/Gruntmaster/HTML.pm log.conf diff --git a/js/90-nav.js b/js/90-nav.js new file mode 100644 index 0000000..3a59943 --- /dev/null +++ b/js/90-nav.js @@ -0,0 +1,20 @@ +(function(){ + 'use strict'; + + var NAVS = { + 'home': /^\/$/, + 'pb': /^\/pb\//, + 'ct': /^\/ct\//, + 'log': /^\/log\//, + 'account': /^\/account$/ + }; + + $( document ).ready(function(){ + var path = location.pathname; + for (var nav in NAVS) + if(path.match(NAVS[nav])) { + $('#nav-' + nav).addClass('active'); + break; + } + }); +})(); diff --git a/tmpl/skel.en b/tmpl/skel.en index d9ce6fc..72df525 100644 --- a/tmpl/skel.en +++ b/tmpl/skel.en @@ -10,11 +10,11 @@