X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4d91fe3dd95c1058cb8d24fd4c900223e30b9059..ad10390663f5c27d4ac9eea1ff35a5a6e2ae4622:/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(); }); });