Skip to content
Snippets Groups Projects
Commit 99bba8f9 authored by Lillian Gray's avatar Lillian Gray
Browse files

Hide other series menus when a menu is opened #13

parent b4fbfa50
Branches
No related merge requests found
......@@ -231,18 +231,29 @@ $(window).resize(function() {
dashboard.draw(lineChartData)
})
//called if series menu is clicked, toggles menu being shown
//called if series menu is clicked, toggles menu being shown and hides other menus
function showSeriesOptions(el) {
el.nextElementSibling.classList.toggle('displayNone')
var optionsClosed = el.nextElementSibling.classList.contains("displayNone")
//close all menus
hideSeriesOptions()
//only opens menu if it was previously closed
if (optionsClosed) {
el.nextElementSibling.classList.remove('displayNone')
}
}
document.addEventListener("click", function(event) {
if (event.target.closest(".seriesSelectDropUp")) return;
elements = document.getElementsByClassName("seriesSelectOptions")
//hides all series menus
function hideSeriesOptions() {
var elements = document.getElementsByClassName("seriesSelectOptions")
for (var i = 0; i < elements.length; i++) {
elements[i].classList.add('displayNone')
}
}
}
//hides series menus if user clicks outside of them
document.addEventListener("click", function(event) {
if (event.target.closest(".seriesSelectDropUp")) return;
hideSeriesOptions()
});
//if site was loaded using a permalink, modifies startDate, endDate, and whichBuildings
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment