From 597a5896af66e4dafdc812669aaa5658565d4c90 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 17 Nov 2016 14:02:41 +0800 Subject: webui: Support toggle the body/contents of sections The section header has class "heading" and a toggle control with class "toggle", which will toggle the display of the next block with the "body" class. --- fg21sim/webui/static/js/main.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'fg21sim/webui/static/js') diff --git a/fg21sim/webui/static/js/main.js b/fg21sim/webui/static/js/main.js index 7f5b582..6db99e0 100644 --- a/fg21sim/webui/static/js/main.js +++ b/fg21sim/webui/static/js/main.js @@ -83,6 +83,23 @@ $(document).ready(function () { scrollTarget(nav_height); }); + // Toggle section contents/body + $(".heading > .toggle").on("click", function () { + var toggle = $(this); + var body = toggle.closest(".heading").next(".body"); + if (body.is(":visible")) { + body.slideUp("fast"); + toggle.removeClass("fa-chevron-circle-up") + .addClass("fa-chevron-circle-down") + .attr("title", "Expand contents"); + } else { + body.slideDown("fast"); + toggle.removeClass("fa-chevron-circle-down") + .addClass("fa-chevron-circle-up") + .attr("title", "Collapse contents"); + } + }); + // Panel toggle control $(".panel-title > .toggle").on("click", function () { var toggle = $(this); -- cgit v1.2.2