]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_resize.html.erb
Trigger map.updateSize() via a custom event
[rails.git] / app / views / site / _resize.html.erb
index f26e2248c50a5d55602be4db3c223b4aa601bd73..4b312bf8c49927890a47d740a5f808df5800761b 100644 (file)
     <% end -%>
     $("#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 -%>
+    $("#map").trigger("resized");
   }
 
   function handleResize() {
@@ -48,4 +45,9 @@
 
     resizeMap();
   }
+
+  $(document).ready(function () {
+    $("#sidebar").on("opened", resizeMap);
+    $("#sidebar").on("closed", resizeMap);
+  });
 </script>