website/js/ntpMenu.js
2021-03-24 22:18:55 +01:00

19 lines
No EOL
663 B
JavaScript

let Plotly = require('plotly.js-dist')
let ntpNav = document.querySelectorAll(".ntpBanner");
ntpNav.forEach((element) => {
element.onclick = function (){
let index = element.getAttribute("data-index");
let contentID = index + "-Content";
let contentElement = document.getElementById(contentID);
if(contentElement.classList.contains("visible")){
contentElement.classList.remove("visible");
} else {
contentElement.classList.add("visible");
Plotly.relayout(index + "-Delay", {autosize: true});
Plotly.relayout(index + "-Score", {autosize: true});
}
}
});