]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_resize.html.erb
Use a param to trigger export rather than a separate action
[rails.git] / app / views / site / _resize.html.erb
index a6583762fea4073778ec986312c373b3b4d74e5e..3e371a417efdc0c2e5e24263947bfaa63bf4b696 100644 (file)
   function resizeMap() {
     var content_width = $("#content").width();
     var content_height = $("#content").height();
-    var sidebar_width = 0 + $("#sidebar:visible").outerWidth(true);
+    var sidebar_width = 0;
     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"));
 
+    $("#sidebar:visible").each(function () {
+      sidebar_width = sidebar_width + $(this).outerWidth(true);
+    });
+
     <% if t('html.dir') == "ltr" -%>
     $("#map").css("left", (sidebar_width) + "px");
     <% else -%>
@@ -44,4 +48,9 @@
 
     resizeMap();
   }
+
+  $(document).ready(function () {
+    $("#sidebar").on("opened", resizeMap);
+    $("#sidebar").on("closed", resizeMap);
+  });
 </script>