this might be a weird question …
I'm using the google maps api to embed custom maps on my webpage. I pass the lon/lat
coordinates along to a function and a map is drawn with this point "centered" in the middle. (my map frame is like 300px high, so the marker is approx at 150px)
Since I'm also using custom infoWindows/Boxes
I'd like to move the center of the map a bit down.
I know I could set a seperate center in lon/lat
coordinates but that's not what I'm looking for. This would require for every map to pass along the coordinates of the marker and the coordinates of the center I'd like to have.
I'd like it to be more simple.
Is it possible to move the center of the map just a few pixels down?
Like center: +30px,
:)
var latlng = new google.maps.LatLng(ll[0], ll[1]); // latitude and longitude
var options = {
zoom: zoom,
//center: c,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
disableDefaultUI: true,
scrollwheel: scroll,
streetViewControl: false,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
}
}
Any idea how I could do that? Any oder tricks or ideas?
Please go to your map and drag and drop your map to the position you wish. You can also zoom in your map a little bit with mouse wheel or zoom cotrols on the bottom right corner of the map. Please remember to save your map after any changes. Hope that helps.
Create a map with the Google Maps API.Google Maps Platform gives you the ability to create a truly custom map that works exactly how you want it to. This method has the advantage of being the most flexible and is free up to certain limits set by Google.
An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. After constructing an InfoWindow, you must call open to display it on the map.
call the panBy-method of the map
mapObject.panBy(0,30)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With