X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/13289d404188bd397ee72852f66c415a2bb87066..52e5fa6ad78f375cec5a207a123a4aa3939c8ddf:/app/views/site/_resize.html.erb diff --git a/app/views/site/_resize.html.erb b/app/views/site/_resize.html.erb index aa64e1d2b..d018cedc9 100644 --- a/app/views/site/_resize.html.erb +++ b/app/views/site/_resize.html.erb @@ -16,19 +16,23 @@ } function resizeMap() { - var sidebar_width = 0 + $("#sidebar:visible").width(); - - if (sidebar_width > 0) { - sidebar_width = sidebar_width + 5 - } + var sidebar_width = 0 + $("#sidebar:visible").outerWidth(true); + var left_border = parseFloat($("#map").css("border-left-width")); + var right_border = parseFloat($("#map").css("border-right-width")); + var top_border = parseFloat($("#map").css("border-top-width")); + var bottom_border = parseFloat($("#map").css("border-bottom-width")); <% if t('html.dir') == "ltr" -%> $("#map").css("left", (sidebar_width) + "px"); <% else -%> $("#map").css("right", (sidebar_width) + "px"); <% end -%> - $("#map").width($("#content").width() - sidebar_width); - $("#map").height($("#content").height() - 2); + $("#map").width($("#content").width() - sidebar_width - left_border - right_border); + $("#map").height($("#content").height() - top_border - bottom_border); + + <% if params[:controller] == "site" and params[:action] == "index" -%> + map.updateSize(); + <% end -%> } function handleResize() {