|
a |
|
b/docs/lagunita/js/custom.js |
|
|
1 |
// Custom Javascript for Lagunita HTML Theme |
|
|
2 |
// You can add custom JS functions to this file. |
|
|
3 |
jQuery(document).ready(function($){ |
|
|
4 |
// Add "active" to nav element if matches body class of "subnav-n" |
|
|
5 |
var bodyClass=""; |
|
|
6 |
var matches = document.body.className.match(/(^|\s+)(subnav-\d+)(\s|$)/); |
|
|
7 |
if (matches) { |
|
|
8 |
// found the bodyClass |
|
|
9 |
bodyClass = matches[2]; |
|
|
10 |
} |
|
|
11 |
|
|
|
12 |
if (bodyClass.length > 0){ |
|
|
13 |
var target = $( '#' + bodyClass ); |
|
|
14 |
target.addClass('active'); |
|
|
15 |
} |
|
|
16 |
}); |