X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4d91fe3dd95c1058cb8d24fd4c900223e30b9059..8255553e9743d0f21ee05b704b4ea2910bf983cc:/app/assets/javascripts/sidebar.js diff --git a/app/assets/javascripts/sidebar.js b/app/assets/javascripts/sidebar.js index a5d906980..912197b9f 100644 --- a/app/assets/javascripts/sidebar.js +++ b/app/assets/javascripts/sidebar.js @@ -5,20 +5,17 @@ function openSidebar(options) { if (options.title) { $("#sidebar_title").html(options.title); } - if (options.width) { $("#sidebar").width(options.width); } - else { $("#sidebar").width("30%"); } + $("#sidebar").width(options.width || "30%"); + $("#sidebar").css("display", "block").trigger("opened"); +} - $("#sidebar").css("display", "block"); - - $("#sidebar").trigger("opened"); -}; +function closeSidebar() { + $("#sidebar").css("display", "none").trigger("closed"); +} $(document).ready(function () { $(".sidebar_close").click(function (e) { - $("#sidebar").css("display", "none"); - - $("#sidebar").trigger("closed"); - + closeSidebar(); e.preventDefault(); }); });