|
@@ -320,23 +320,19 @@ function makeFloorList(options) {
|
|
|
|
|
|
|
|
|
function activeNavbar(selector) {
|
|
|
- var baseHref = window.location.href;
|
|
|
- navbarIndex = localStorage.getItem('navbarIndex') || 0;
|
|
|
+ var pathname = window.location.pathname.replace(/(-\d+){0,}(.html$)/g, '') + '.html';
|
|
|
+ console.log(pathname);
|
|
|
selector = $(selector);
|
|
|
- selector.each(function (index, el) {
|
|
|
+ selector.each(function(index, el){
|
|
|
$(el).removeClass('active');
|
|
|
-
|
|
|
- if ($(el).find('a').length > 0) {
|
|
|
+ if($(el).find('a').length > 0){
|
|
|
var href = $(el).find('a').attr('href');
|
|
|
- href = href.split('?')[0].split('#')[0];
|
|
|
-
|
|
|
- if (baseHref.indexOf(href) > -1) {
|
|
|
- navbarIndex = index;
|
|
|
- localStorage.setItem('navbarIndex', navbarIndex);
|
|
|
+ console.log(href);
|
|
|
+ if(pathname.endsWith(href)){
|
|
|
+ $(el).addClass('active');
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
- selector.eq(navbarIndex).addClass('active');
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
/**
|