javascript - Google maps set different zoom based on window resize -


following previous question google maps responsive resize implement different zoom level based on windows resize, if browser windows "less then" apply x number of zooming , if "major than" apply zooming level automatically.

the following code works in regards of recentering map on windows resize, need apply new zoom levels it:

var map;  function initialize() {   var mapoptions = {   center: new google.maps.latlng(40.5472,12.282715),   zoom: 6,   maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid("map-canvas"),       mapoptions); } google.maps.event.adddomlistener(window, 'load', initialize); google.maps.event.adddomlistener(window, "resize", function() {   var center = map.getcenter();   google.maps.event.trigger(map, "resize");   map.setcenter(center);    map.setzoom(zoom level needs automatically set according window size); }); 

construct area want in view creating latlngbounds , call map.fitbounds() suggested geocodezip.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -