My code works in Google Chrome and IE but does not work in Firefox 12. Anyone know how I can make it work in Firefox 12?
Code:
...
/* START FULLSCREEN BUTTON */
// Globals
var map_size = 'small';
var map_position= 'inherit';
var map_top = 0;
var map_left = 0;
var map_width = 0;
var map_height = 0;
var map_zIndex = 0;
...
// when button clicked
if(map_size == 'small') {
map_size = 'large';
map_position= $('div.map').css('position');
map_top = $('div.map').css('top');
map_left = $('div.map').css('left');
map_width = $('div.map').css('width');
map_height = $('div.map').css('height');
map_zIndex = $('div.map').css('z-index');
$('#fullscreen').attr('src','/assets/images/restore.png');
$('#enlarge').html('Shrink Map');
controlUI.title = 'Click to make map smaller';
$('div.map').css('position', "fixed");
$('div.map').css('top', "10%");
$('div.map').css('left', "10%");
$('div.map').css('width', "80%");
$('div.map').css('height', "80%");
$('div.map').css('z-index', 10000);
google.maps.event.trigger(map,'resize');
map.panToBounds(bounds);
map.fitBounds(bounds);
} else {
map_size = 'small';
$('div.map').css('position', map_position);
$('div.map').css('top', map_top);
$('div.map').css('left', map_left);
$('div.map').css('width', map_width);
$('div.map').css('height', map_height);
$('div.map').css('z-index', map_zIndex);
$('#fullscreen').attr('src','/assets/images/fullscreen.png');
$('#enlarge').html('Enlarge Map');
controlUI.title = 'Click to make map bigger';
google.maps.event.trigger(map,'resize');
map.panToBounds(bounds);
map.fitBounds(bounds);
}
}
...
Here's a live example http://www.helloflight.com/flight/dlh410.cfm
Update - Note that the live example is using the setTimeout solution below, and thus works in Firefox 12, but without the setTimeout solution does not work in Firefox 12
As you can see, it works in the latest version of Safari, Google Chrome, and IE, but in Firefox, when the map div is enlarged, the map tiles continue to be the size of the original div dimensions and don't expand to fill the new div dimensions.