Posted By

koycarraway on 01/12/13


Tagged


Versions (?)

Center Google Map (v3) during browser resize


 / Published in: JavaScript
 

  1. var center;
  2. function calculateCenter() {
  3. center = map.getCenter();
  4. }
  5. google.maps.event.addDomListener(map, 'idle', function() {
  6. calculateCenter();
  7. });
  8. google.maps.event.addDomListener(window, 'resize', function() {
  9. map.setCenter(center);
  10. });

Report this snippet  

You need to login to post a comment.