Every time I embed an iframe from Google Maps it keeps the marker in the middle.
And it does even if there's a tooltip and just CUTS the tooltip data:
http://开发者_开发百科jsfiddle.net/V2SVa/
Are there url parameters or something to center the map on the tooltip?
Well, if you are using the API, then you can issue a call to map.setCenter().
If however you are including the maps inline as in your example, then you just need to change the initial starting point.
The URL you are using to embed the map is:
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=
&q=Museum+near+Washington,+United+States&aq=0
&sll=40.702863,-74.055748&sspn=0.025669,0.055747&ie=UTF8
&hq=Museum&hnear=Washington+D.C.,+District+of+Columbia
&ll=38.913976,-77.05111&spn=0.052698,0.111494&t=h&z=14
&iwloc=A&cid=4718114823360363843&output=embed
Just a matter of adjusting certain parameters.
The parameters you need to adjust are ll = center location
, z = zoom level
and spn/sspn = span / screen span
. Surprisingly awkward to find information on them, but there is some details on the parameters here. Try fiddling with the ll
parameter first if you need to change just the centre.
This works for me:
HTML
<div style="height: 400px; overflow: hidden;">
<iframe width="425" height="700" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Museum+near+Washington,+United+States&aq=0&sll=40.702863,-74.055748&sspn=0.025669,0.055747&ie=UTF8&hq=Museum&hnear=Washington+D.C.,+District+of+Columbia&ll=38.913976,-77.05111&spn=0.052698,0.111494&t=h&z=14&iwloc=A&cid=4718114823360363843&output=embed"></iframe>
</div>
JQUERY (not even necessary)
$("iframe").load(function (){
$('iframe').css({"height": '400px'});
});
Demo: http://tinker.io/9ace5
精彩评论