Skip to content

Instantly share code, notes, and snippets.

@lou
Created January 2, 2012 12:10
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save lou/1550454 to your computer and use it in GitHub Desktop.
Save lou/1550454 to your computer and use it in GitHub Desktop.
Google map Fullscreen with jQuery
$(function() {
var map = new google.maps.Map(document.getElementById("map_canvas"), {});
var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
var googleMapWidth = $("#map_canvas").css('width');
var googleMapHeight = $("#map_canvas").css('height');
map.setCenter(newyork);
$('#enter-full-screen').click(function(){
$("#map_canvas").css("position", 'fixed').
css('top', 0).
css('left', 0).
css("width", '100%').
css("height", '100%');
google.maps.event.trigger(map, 'resize');
map.setCenter(newyork);
return false;
});
$('#exit-full-screen').click(function(){
$("#map_canvas").css("position", 'relative').
css('top', 0).
css("width", googleMapWidth).
css("height", googleMapHeight);
google.maps.event.trigger(map, 'resize');
map.setCenter(newyork);
return false;
});
});
@ayyoobcastro
Copy link

how can add a button on a map

please help me someone

@null0rUndefined
Copy link

mhdayyoob,
map.controls[google.maps.ControlPosition.TOP_CENTER].push(document.getElementById('yourElement'));
You can read more about this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment