Trigger map.updateSize() via a custom event

This commit is contained in:
John Firebaugh 2012-09-07 12:40:00 -07:00
parent b507f6c887
commit 7ff77d9d3d
2 changed files with 5 additions and 4 deletions

View file

@ -71,6 +71,10 @@ function createMap(divName, options) {
}); });
map.addLayer(markers); map.addLayer(markers);
$("#" + divName).on("resized", function () {
map.updateSize();
});
return map; return map;
} }

View file

@ -35,10 +35,7 @@
<% end -%> <% end -%>
$("#map").width(content_width - sidebar_width - left_border - right_border); $("#map").width(content_width - sidebar_width - left_border - right_border);
$("#map").height(content_height - top_border - bottom_border); $("#map").height(content_height - top_border - bottom_border);
$("#map").trigger("resized");
<% if params[:controller] == "site" and params[:action] == "index" -%>
map.updateSize();
<% end -%>
} }
function handleResize() { function handleResize() {