From: Tom Hughes Date: Sat, 26 Nov 2011 18:12:58 +0000 (+0000) Subject: Avoid having to condition on mobile mode X-Git-Tag: live~6504 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/9afbaf1984c12dee73b432c67475d97c0f1f2add Avoid having to condition on mobile mode --- diff --git a/app/assets/stylesheets/ltr.css.scss b/app/assets/stylesheets/ltr.css.scss index d557ba618..817404a79 100644 --- a/app/assets/stylesheets/ltr.css.scss +++ b/app/assets/stylesheets/ltr.css.scss @@ -106,6 +106,7 @@ html body { #sidebar { left: 0px; + margin-right: 3px; } #sidebar #sidebar_title { diff --git a/app/assets/stylesheets/rtl.css.scss b/app/assets/stylesheets/rtl.css.scss index b4ae98dbc..953efd7a6 100644 --- a/app/assets/stylesheets/rtl.css.scss +++ b/app/assets/stylesheets/rtl.css.scss @@ -107,6 +107,7 @@ html body { #sidebar { right: 0px; + margin-left: 3px; } #sidebar #sidebar_title { diff --git a/app/assets/stylesheets/small.css.scss b/app/assets/stylesheets/small.css.scss index 4dee3f1bf..07b5d7b10 100644 --- a/app/assets/stylesheets/small.css.scss +++ b/app/assets/stylesheets/small.css.scss @@ -118,6 +118,7 @@ h1 { #sidebar { border: 0px; border-right: 1px solid #ccccdd; + margin: 0px; } .sidebar_title, #sidebar_content { diff --git a/app/views/site/_resize.html.erb b/app/views/site/_resize.html.erb index 9ee05a7c8..30ee81f05 100644 --- a/app/views/site/_resize.html.erb +++ b/app/views/site/_resize.html.erb @@ -16,21 +16,19 @@ } function resizeMap() { - var sidebar_width = 0 + $("#sidebar:visible").width(); - - if (sidebar_width > 0 && window.width > 641) { - sidebar_width = sidebar_width + 5 - } + var sidebar_width = 0 + $("#sidebar:visible").outerWidth(true); + var left_border = 0 + $("#map").css("border-left-width"); + var right_border = 0 + $("#map").css("border-right-width"); + var top_border = 0 + $("#map").css("border-top-width"); + var bottom_border = 0 + $("#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); - if (window.width > 641) { - $("#map").height($("#content").height() - 2); - } + $("#map").width($("#content").width() - sidebar_width - left_border - right_border); + $("#map").height($("#content").height() - top_border - bottom_border); } function handleResize() {