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