Strange question, I think, but I have this bit of code on my page ...
$(".map-overlay-left").click(function () {
$("#map-holder").hide('slow');
var gmarkers = [];
var side_bar_html = "";
var map = new GMap2(document.getElementById('map-holder'));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var Africa = new GLatLng(-2.767478,23.730469);
map.setCenter(Africa, 4);
$.get("http://xx.xxx.xxxx.xxx/xml-feed-google-maps",{},function(xml) {
$('marker',xml).each(function(i) {
html = $(this).text();
lat = $(this).attr("lat");
lng = $(this).attr("lng");
label = $(this).attr("label");
var point = new GLatLng(lat,lng);
var marker = createMarker(point,label,html);
map.addOverlay(marker);
});
});
$("#map-holder").show('slow');
});
It works fantastically and does what I want functionally just not UI wise. This meant first making a good transition to hide the โmap holderโ div, displaying the google map inside it, and then making a good transition back to size. Transition is show / hide jQuery by default.
Now the problem that I seem to get is that the Google map is displayed while this one $("#map-holder").hide('slow');is still working, and you see glimpses of the map before it hides and then opens again, which causes a bewildering effect.
, - , , hide , ? ( - setTimeout).
!
1
hide, GMap. Chrome/FF/Safari , . IE . GMap div.
http://afid.staging.dante-studios.com/ ( , ).
, ?
2
Google , div :
$(".map-overlay-left").click(function () {
$("#map-holder").hide('slow', function(){
var gmarkers = [];
var side_bar_html = "";
var map = new GMap2(document.getElementById('map-holder'));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var Africa = new GLatLng(-2.767478,23.730469);
map.setCenter(Africa, 4);
$.get("http://afid.staging.dante-studios.com/xml-feed-google-maps",{},function(xml) {
$('marker',xml).each(function(i) {
html = $(this).text();
lat = $(this).attr("lat");
lng = $(this).attr("lng");
label = $(this).attr("label");
var point = new GLatLng(lat,lng);
var marker = createMarker(point,label,html);
map.addOverlay(marker);
});
});
});
$("#map-holder").show('slow');
map.checkResize();
map.setCenter(Africa, 4);
});
, , map.checkResize();. ?