diff --git a/css/simple_geo.css b/css/simple_geo.css index c4c935e..887c2f7 100644 --- a/css/simple_geo.css +++ b/css/simple_geo.css @@ -1,5 +1,15 @@ -.address-search { +#micro-map-widget .address-search { background-color: #fff; border: 1px solid #000; padding: 2px; +} + +#micro-map-widget { + height: 200px; +} + +#micro-map-info-window { + background-color: #fff; + border: 1px solid #000; + padding: 5px; } \ No newline at end of file diff --git a/js/micromap.js b/js/micromap.js index 6db51e8..63cb7a7 100644 --- a/js/micromap.js +++ b/js/micromap.js @@ -6,7 +6,7 @@ if (google && google.load) { google.load('maps', '2.x'); jQuery(document).ready(function () { - var positions, map_highlight, placeholder, map, icon, tmp_ids, bounds, pos_len, i, lat, lng, pos, marker, default_zoom, default_center, map_state, placeholder_html, micromap_parent, micromap_add_mode; + var positions, info_window, info_window_content, map_highlight, placeholder, map, icon, tmp_ids, bounds, pos_len, i, lat, lng, pos, marker, default_zoom, default_center, map_state, placeholder_html, micromap_parent, micromap_add_mode; positions = jQuery('.geo'); @@ -80,7 +80,14 @@ if (google && google.load) { }); } else { - map.openInfoWindow(marker.getLatLng(),title.get(0).cloneNode(true)); + var pos = map.fromLatLngToContainerPixel(marker.getLatLng()); + info_window_content.empty().append(title.get(0).cloneNode(true)); + var widget_offset = $(placeholder).offset(); + info_window.css({ + 'position': 'absolute', + 'top': pos.y + widget_offset.top, + 'left': pos.x + widget_offset.left + }).show(); } }; }(positions.get(i), marker)); @@ -120,6 +127,18 @@ if (google && google.load) { } map.checkResize(); map.setCenter(center); + info_window.hide(); + }); + + info_window = $('