tabs feature, data sent from controller.

This commit is contained in:
2019-12-13 14:51:46 +01:00
parent fb9c3cdff3
commit 03c75b811e
3 changed files with 97 additions and 85 deletions

View File

@@ -58,6 +58,20 @@ let setPaneHeight = function(contents)
});
}
/*
* Check if links are defined in controller
* If true, disable javascript listener
*/
let isLinkRef = function(link) {
if (link.getAttribute('href') == "#") {
return false;
}
return true;
}
/*
* Main function
*/
@@ -82,17 +96,19 @@ window.addEventListener('load', function()
}
setPaneHeight(contents);
// initial position
setNewActive(links, contents, unit.startPanel);
// listen
links.forEach(function(link) {
link.addEventListener('click', function()
{
resetActive(links, contents);
setNewActive(links, contents, countNewActive(links, link));
});
if (isLinkRef(link) == false) {
link.addEventListener('click', function()
{
resetActive(links, contents);
setNewActive(links, contents, countNewActive(links, link));
});
}
});
});