|
@@ -40,8 +40,6 @@ rivets.configure({
|
|
|
executeFunctions: true
|
|
executeFunctions: true
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
var app = document.getElementById('app');
|
|
var app = document.getElementById('app');
|
|
|
var view = rivets.bind(app, {
|
|
var view = rivets.bind(app, {
|
|
|
sections: sections,
|
|
sections: sections,
|
|
@@ -50,16 +48,17 @@ var view = rivets.bind(app, {
|
|
|
var newValue = event.target.text;
|
|
var newValue = event.target.text;
|
|
|
window.history.pushState({}, newValue, '#' + newValue)
|
|
window.history.pushState({}, newValue, '#' + newValue)
|
|
|
chooseSection(newValue);
|
|
chooseSection(newValue);
|
|
|
|
|
+ event.target.className = 'selected';
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function chooseSection(section) {
|
|
function chooseSection(section) {
|
|
|
- for (var key in selectedSection_) {
|
|
|
|
|
- var isSelected = (key === section);
|
|
|
|
|
- selectedSection_[key] = isSelected;
|
|
|
|
|
- }
|
|
|
|
|
- //event.target.classList = isSelected ? ['selected-section'] : event.target.classList.filter(function (c) { return c !== 'selected-section'; })
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var navbarList = window.document.querySelectorAll('ul.navbar-list > li > a');
|
|
|
|
|
+ navbarList.forEach(function (el) {
|
|
|
|
|
+ var isSelected = el.text === section;
|
|
|
|
|
+ el.className = isSelected ? 'selected' : '';
|
|
|
|
|
+ selectedSection_[el.text] = isSelected;
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
var elements = [];
|
|
var elements = [];
|
|
|
|
|
|